From 54f6975033c299bb20a34c852a3bc28e5c594f5b Mon Sep 17 00:00:00 2001 From: Dale Zak Date: Thu, 24 Jan 2019 10:33:07 -0600 Subject: [PATCH] Added nul check to API removeToken for ushahidi/tenfour-mobile#367 --- src/providers/api/api.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/providers/api/api.ts b/src/providers/api/api.ts index 274d5b08..29dd7f62 100644 --- a/src/providers/api/api.ts +++ b/src/providers/api/api.ts @@ -100,12 +100,17 @@ export class ApiProvider extends HttpProvider { public removeToken(organization:Organization):Promise { return new Promise((resolve, reject) => { - this.storage.remove(organization.subdomain).then((removed:any) => { - resolve(true); - }, - (error:any) => { + if (organization) { + this.storage.remove(organization.subdomain).then((removed:any) => { + resolve(true); + }, + (error:any) => { + resolve(false); + }); + } + else { resolve(false); - }); + } }); }