Skip to content
This repository has been archived by the owner on Dec 13, 2019. It is now read-only.

Commit

Permalink
Feature detection mechanism cuba-platform/cuba-rest-js#20
Browse files Browse the repository at this point in the history
  • Loading branch information
vyacheslav-pushkin committed Dec 5, 2019
1 parent d0cf6b6 commit e9b6c7a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"react-intl": "^3.3.2"
},
"devDependencies": {
"@cuba-platform/rest": "0.7.0-dev.2",
"@cuba-platform/rest": "0.7.0-dev.3",
"@types/jest": "^24.0.18",
"@types/moment-timezone": "^0.5.12",
"@types/react": "^16.7.18",
Expand Down
10 changes: 8 additions & 2 deletions src/app/MainStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,14 @@ export class MainStore {
};

setSessionLocale = () => {
// noinspection JSIgnoredPromiseFromCall
this.cubaREST.setSessionLocale();
this.cubaREST.setSessionLocale().catch((reason) => {
if (reason === CubaApp.NOT_SUPPORTED_BY_API_VERSION) {
throw new Error('Relogin is required in order for bean validation messages to use correct locale. ' +
'Upgrade to REST API 7.2.0 or higher to be able to change locale without relogin.');
} else {
throw new Error('Failed to set session locale');
}
});
};

@computed get loginRequired(): boolean {
Expand Down

0 comments on commit e9b6c7a

Please sign in to comment.