This commit is contained in:
2020-08-07 22:24:49 +00:00
parent 3770cc7fda
commit d2bf0c9000
4 changed files with 272 additions and 0 deletions

View File

@@ -373,6 +373,15 @@ export default {
return this.APIUrl(url);
},
/////////////////////////////
// logo download URL
// (size= 'small', 'medium', 'large')
logoUrl(size) {
//http://localhost:7575/api/v8/logo/small
let url = "logo/" + size;
return this.APIUrl(url);
},
/////////////////////////////
// REPLACE END OF URL
// (used to change ID in url)
replaceAfterLastSlash(theUrl, theReplacement) {
@@ -573,6 +582,36 @@ export default {
} catch (error) {
handleError("POSTATTACHMENT", error, route);
}
},
///////////////////////////////////
// POST LOGO
//
//
async uploadLogo(fileData, size) {
let that = this;
try {
var data = new FormData();
data.append(fileData.name, fileData);
//-----------------
let fetchOptions = {
method: "post",
mode: "cors",
headers: {
Authorization: "Bearer " + window.$gz.store.state.apiToken
},
body: data
};
let r = await fetch(that.APIUrl("logo/" + size), fetchOptions);
that.statusEx(r);
r = await that.extractBodyEx(r);
return r;
} catch (error) {
handleError("uploadLogo", error, route);
}
}
//---------------