Skip to content
Snippets Groups Projects
Commit 18ed563a authored by Jérémie BRISON's avatar Jérémie BRISON
Browse files

fix structureLink error

parent 5574137b
No related branches found
No related tags found
3 merge requests!68Recette,!67Dev,!49fix structureLink error
......@@ -14,7 +14,7 @@ export class ProfileService {
public async getProfile(): Promise<User> {
// Get profil by API only on first time
if (!this.currentProfile) {
if (!this.currentProfile && this.authService.isLoggedIn()) {
const profile = await this.http.get<User>(`${this.baseUrl}/profile`).toPromise();
this.currentProfile = profile;
}
......@@ -22,6 +22,12 @@ export class ProfileService {
}
public isLinkedToStructure(idStructure: number): boolean {
if (!this.authService.isLoggedIn()) {
this.currentProfile = null;
}
if (!this.currentProfile) {
return false;
}
return this.currentProfile.structuresLink.includes(idStructure);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment