-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ajout du type d'environnement dans l'IHM
- Loading branch information
1 parent
4b93eb7
commit 75b71d3
Showing
5 changed files
with
89 additions
and
12 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
frontend/app/src/domains/commons/service/EnvironmentTypeService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export class EnvironmentTypeService { | ||
|
||
environmentType: {label: String, color: String} | undefined = undefined | ||
|
||
async getEnvironmentType() { | ||
if (!this.environmentType) { | ||
await this.loadEnvironmentType() | ||
} | ||
return this.environmentType | ||
} | ||
|
||
private async loadEnvironmentType() { | ||
if (process.env.REACT_APP_MOCK_API) { | ||
this.environmentType = {label: 'MOCK', color: 'red'} | ||
} else { | ||
let response = await fetch(window.location.origin + '/config/viandeendirect.json') | ||
let config = await response.json() | ||
this.environmentType = {label: config.environmentTypeLabel, color: config.environmentTypeColor} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters