I am new to Angular and JHipster and need help solving a problem. I have not made any changes to the code, it is still using JHipster's default code for login.
Stack trace:
TypeError: this.accountService is undefined Stack trace: LoginService.prototype.logout@webpack-internal:///./src/main/webapp/app/core/login/login.service.ts:33:9 NavbarComponent.prototype.logout@webpack-internal:///./src/main/webapp/app/layouts/navbar/navbar.component.ts:49:9 View_NavbarComponent_30/<@ng:///NgrkAppModule/NavbarComponent.ngfactory.js:1470:23
core/login/login.service.ts:
import { AccountService } from 'app/core/auth/account.service';
--------------------------------------------------
constructor(private accountService: AccountService)
--------------------------------------------------
login(credentials, callback?) {
const cb = callback || function() {};
return new Promise((resolve, reject) => {
this.authServerProvider.login(credentials).subscribe(
data => {
this.accountService.identity(true).then(account => {
resolve(data);
});
return cb();
},
err => {
this.logout();
reject(err);
return cb(err);
}
);
});
}
logout() {
this.authServerProvider.logout().subscribe();
this.accountService.authenticate(null);
}
core/auth/account.service.ts:
export class AccountService {
--------------------------------
authenticate() {
some code;
}
identity() {
some code;
}
--------------------------------
}