Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
web-app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
web-et-numerique-internet
data.grandlyon.com
web-portal
components
custom-apps
web-app
Commits
dccfecdd
Commit
dccfecdd
authored
5 years ago
by
FORESTIER Fabien
Browse files
Options
Downloads
Patches
Plain Diff
Make sure the app still starts if the user initialization fails
parent
50d2123c
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!53
Version 2.3.2
Pipeline
#1783
passed
5 years ago
Stage: build
Stage: deploy
Stage: post-deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/app/app.module.ts
+13
-5
13 additions, 5 deletions
src/app/app.module.ts
src/i18n/traductions.fr.ts
+1
-0
1 addition, 0 deletions
src/i18n/traductions.fr.ts
src/i18n/traductions.ts
+1
-0
1 addition, 0 deletions
src/i18n/traductions.ts
with
15 additions
and
5 deletions
src/app/app.module.ts
+
13
−
5
View file @
dccfecdd
...
@@ -10,17 +10,25 @@ import { EditorialisationModule } from './editorialisation/editorialisation.modu
...
@@ -10,17 +10,25 @@ import { EditorialisationModule } from './editorialisation/editorialisation.modu
import
{
Angulartics2Module
}
from
'
angulartics2
'
;
import
{
Angulartics2Module
}
from
'
angulartics2
'
;
import
{
UserModule
}
from
'
./user/user.module
'
;
import
{
UserModule
}
from
'
./user/user.module
'
;
import
{
UserService
}
from
'
./user/services
'
;
import
{
UserService
}
from
'
./user/services
'
;
import
{
AppConfigService
}
from
'
./core/services
'
;
import
{
AppConfigService
,
NotificationService
}
from
'
./core/services
'
;
import
{
timeout
}
from
'
rxjs/operators
'
;
import
{
notificationMessages
}
from
'
../i18n/traductions
'
;
// Function used by APP_INITIALIZER before the app start: init user info / statut (expect a promise)
// Function used by APP_INITIALIZER before the app start: init user info / statut (expect a promise)
export
function
initUserService
(
authService
:
UserService
)
{
export
function
initUserService
(
authService
:
UserService
,
notificationService
:
NotificationService
)
{
return
():
Promise
<
any
>
=>
{
return
():
Promise
<
any
>
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
authService
.
initializeService
().
subscribe
(
authService
.
initializeService
().
pipe
(
timeout
(
3000
)).
subscribe
(
()
=>
{
()
=>
{
resolve
();
resolve
();
},
},
()
=>
{
(
err
)
=>
{
if
(
err
.
status
!==
401
)
{
notificationService
.
notify
({
type
:
'
error
'
,
message
:
notificationMessages
.
userInfo
.
userInit
,
});
}
resolve
();
resolve
();
});
});
});
});
...
@@ -61,7 +69,7 @@ export function initAppConfig(appConfigService: AppConfigService) {
...
@@ -61,7 +69,7 @@ export function initAppConfig(appConfigService: AppConfigService) {
{
{
provide
:
APP_INITIALIZER
,
provide
:
APP_INITIALIZER
,
useFactory
:
initUserService
,
useFactory
:
initUserService
,
deps
:
[
UserService
],
deps
:
[
UserService
,
NotificationService
],
multi
:
true
,
multi
:
true
,
},
},
],
],
...
...
This diff is collapsed.
Click to expand it.
src/i18n/traductions.fr.ts
+
1
−
0
View file @
dccfecdd
...
@@ -68,6 +68,7 @@ export const notificationMessages = {
...
@@ -68,6 +68,7 @@ export const notificationMessages = {
userPasswordUpdated
:
'
Votre mot de passe a été mis à jour.
'
,
userPasswordUpdated
:
'
Votre mot de passe a été mis à jour.
'
,
wrongOldPassword
:
'
Il semblerait que l
\'
ancien mot de passe saisi soit incorrect.
'
,
wrongOldPassword
:
'
Il semblerait que l
\'
ancien mot de passe saisi soit incorrect.
'
,
errorDeletingAccount
:
'
Une erreur est survenue lors de la suppression de votre compte.
'
,
errorDeletingAccount
:
'
Une erreur est survenue lors de la suppression de votre compte.
'
,
userInit
:
'
Une erreur est survenue lors de la récupération des informations de votre compte.
'
,
},
},
general
:
{
general
:
{
failedDownloadFile
:
'
Désolé, il n
\'
a pas été possible de télécharger le fichier. Essayez plus tard !
'
,
failedDownloadFile
:
'
Désolé, il n
\'
a pas été possible de télécharger le fichier. Essayez plus tard !
'
,
...
...
This diff is collapsed.
Click to expand it.
src/i18n/traductions.ts
+
1
−
0
View file @
dccfecdd
...
@@ -67,6 +67,7 @@ export const notificationMessages = {
...
@@ -67,6 +67,7 @@ export const notificationMessages = {
failedToUpdateUserPassword
:
'
An error occured while updating your password.
'
,
failedToUpdateUserPassword
:
'
An error occured while updating your password.
'
,
wrongOldPassword
:
'
Looks like the old password entered is incorrect.
'
,
wrongOldPassword
:
'
Looks like the old password entered is incorrect.
'
,
errorDeletingAccount
:
'
An error occured while deleting your account.
'
,
errorDeletingAccount
:
'
An error occured while deleting your account.
'
,
userInit
:
'
An error occured while retrieving your account information.
'
,
},
},
general
:
{
general
:
{
failedDownloadFile
:
'
Sorry, it was not possible to download the file. Try later !
'
,
failedDownloadFile
:
'
Sorry, it was not possible to download the file. Try later !
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment