fix: use .call to change context in authRequest

This commit is contained in:
thecodrr
2020-05-23 17:29:02 +05:00
parent f20ec7e387
commit f3538df1cd

View File

@@ -13,7 +13,7 @@ export default class User {
async sync() { async sync() {
var user = await this.get(); var user = await this.get();
if (!user) return; if (!user) return;
user = await authRequest("users", undefined, true, true); user = await authRequest.call(this, "users", undefined, true, true);
delete user.lastSynced; delete user.lastSynced;
await this.set(user); await this.set(user);
} }
@@ -39,7 +39,7 @@ export default class User {
if (!user || !refno) return; if (!user || !refno) return;
await this.set({ refno, upgrading: true }); await this.set({ refno, upgrading: true });
let response = await authRequest("upgrade", { refno }, true); let response = await authRequest.call(this, "upgrade", { refno }, true);
if (response.duration) { if (response.duration) {
await this.set({ await this.set({
refno: undefined, refno: undefined,