fix: append base_url for requests from cordova app (#7895)

This commit is contained in:
Shivam Mishra 2019-07-15 15:34:43 +05:30 committed by Faris Ansari
parent 4134d3773d
commit 4e87357152
2 changed files with 10 additions and 0 deletions

View file

@ -464,6 +464,11 @@ frappe.Application = Class.extend({
return frappe.call('frappe.client.get_hooks', { hook: 'app_logo_url' })
.then(r => {
frappe.app.logo_url = (r.message || []).slice(-1)[0];
if (window.cordova) {
let host = frappe.request.url;
host = host.slice(0, host.length - 1);
frappe.app.logo_url = host + frappe.app.logo_url;
}
});
},

View file

@ -80,6 +80,11 @@ frappe.call = function(opts) {
let url = opts.url;
if (!url) {
url = '/api/method/' + args.cmd;
if (window.cordova) {
let host = frappe.request.url;
host = host.slice(0, host.length - 1);
url = host + url;
}
delete args.cmd;
}