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); - }); + } }); }