Open ofaasd opened 7 years ago
i follow ur step by step tutorial in your site but i get this error after logout button clicked.
Uncaught (in promise): TypeError: _this.loading is undefined HomePage.prototype.logout/<@http://localhost:8100/build/main.js:56196:13 f</t.prototype.invoke@http://localhost:8100/build/polyfills.js:3:8969 onInvoke@http://localhost:8100/build/main.js:4480:28 f</t.prototype.invoke@http://localhost:8100/build/polyfills.js:3:8896 c</r.prototype.run@http://localhost:8100/build/polyfills.js:3:4121 f/<@http://localhost:8100/build/polyfills.js:3:13729 f</t.prototype.invokeTask@http://localhost:8100/build/polyfills.js:3:9644 onInvokeTask@http://localhost:8100/build/main.js:4471:28 f</t.prototype.invokeTask@http://localhost:8100/build/polyfills.js:3:9557 c</r.prototype.runTask@http://localhost:8100/build/polyfills.js:3:4812 o@http://localhost:8100/build/polyfills.js:3:1884 t/this.invoke@http://localhost:8100/build/polyfills.js:3:10673
auth-service.ts logout(){ return new Promise((resolve, reject) => { let headers = new Headers(); headers.append('X-Auth-Token', localStorage.getItem('token'));
this.http.post(apiUrl+'user/logout', {}, {headers: headers}) .subscribe(res => { localStorage.clear(); }, (err) => { reject(err); });
}); }
home.ts logout() { this.AuthServiceProvider.logout().then((result) => { this.loading.dismiss(); let nav = this.app.getRootNav(); nav.setRoot(LoginPage); }, (err) => { this.loading.dismiss(); this.presentToast(err); }); }
can u help me to fix this ?
you are not declaring "loading" variable
i follow ur step by step tutorial in your site but i get this error after logout button clicked.
Uncaught (in promise): TypeError: _this.loading is undefined HomePage.prototype.logout/<@http://localhost:8100/build/main.js:56196:13 f</t.prototype.invoke@http://localhost:8100/build/polyfills.js:3:8969 onInvoke@http://localhost:8100/build/main.js:4480:28 f</t.prototype.invoke@http://localhost:8100/build/polyfills.js:3:8896 c</r.prototype.run@http://localhost:8100/build/polyfills.js:3:4121 f/<@http://localhost:8100/build/polyfills.js:3:13729 f</t.prototype.invokeTask@http://localhost:8100/build/polyfills.js:3:9644 onInvokeTask@http://localhost:8100/build/main.js:4471:28 f</t.prototype.invokeTask@http://localhost:8100/build/polyfills.js:3:9557 c</r.prototype.runTask@http://localhost:8100/build/polyfills.js:3:4812 o@http://localhost:8100/build/polyfills.js:3:1884 t/this.invoke@http://localhost:8100/build/polyfills.js:3:10673
auth-service.ts logout(){ return new Promise((resolve, reject) => { let headers = new Headers(); headers.append('X-Auth-Token', localStorage.getItem('token'));
}); }
home.ts logout() { this.AuthServiceProvider.logout().then((result) => { this.loading.dismiss(); let nav = this.app.getRootNav(); nav.setRoot(LoginPage); }, (err) => { this.loading.dismiss(); this.presentToast(err); }); }
can u help me to fix this ?