Add clientBaseUrl and download PDF

This commit is contained in:
Thilina
2021-06-27 18:12:01 +02:00
parent 66b3f006e6
commit 74e448bf5d

View File

@@ -44,6 +44,7 @@ class ModuleBase {
this.currentProfile = null;
this.permissions = {};
this.baseUrl = null;
this.clientUrl = null;
this.that = this;
}
@@ -96,6 +97,10 @@ class ModuleBase {
this.baseUrl = url;
}
setClientUrl(url) {
this.clientUrl = url;
}
setUser(user) {
this.user = user;
}
@@ -143,7 +148,7 @@ class ModuleBase {
gt(key) {
if (this.translations[key] === undefined || this.translations[key] === null) {
console.log("Tr:" + key);
console.log(`Tr:${key}`);
return key;
}
return this.translations[key][0];
@@ -2683,6 +2688,11 @@ class ModuleBase {
return `https://avatars.dicebear.com/api/initials/:${seed}.svg`;
}
downloadPdf(type, data) {
const url = `${this.clientUrl}service.php?a=pdf&h=${type}&data=${data}`;
window.open(url,'_blank');
}
}
export default ModuleBase;