diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue index c2d7d3946..0297f2c8b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue @@ -15,6 +15,12 @@ +
+

+ {{ error.sta }} {{ error.txt }}
+ {{ $t(error.msg) }} +

+
@@ -89,6 +96,16 @@ export default { } table { } + + &.errors { + //display: flex; + //position: sticky; + //bottom: 0.3em; + //z-index: 1000; + margin: 1em 0; + padding: 1em; + border-radius: 0; + } } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/api.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/api.js index 676bbf7b7..52e253ac1 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/api.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/api.js @@ -9,7 +9,7 @@ const getAccompanyingCourse = (id) => { return fetch(url) .then(response => { if (response.ok) { return response.json(); } - throw Error('Error with request resource response'); + throw { msg: 'Error while retriving AccompanyingPeriod Course.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body }; }); }; @@ -32,7 +32,8 @@ const patchAccompanyingCourse = (id, body) => { }) .then(response => { if (response.ok) { return response.json(); } - throw Error('Error with request resource response'); + console.log(response); + throw { msg: 'Error while updating AccompanyingPeriod Course.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body }; }); }; @@ -47,7 +48,7 @@ const confirmAccompanyingCourse = (id) => { }) .then(response => { if (response.ok) { return response.json(); } - throw Error('Error with request resource response'); + throw { msg: 'Error while confirming AccompanyingPeriod Course.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body }; }); }; @@ -59,7 +60,7 @@ const getSocialIssues = () => { return fetch(url) .then(response => { if (response.ok) { return response.json(); } - throw Error('Error with request resource response'); + throw { msg: 'Error while retriving Social Issues.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body }; }); }; @@ -83,7 +84,7 @@ const postParticipation = (id, payload, method) => { }) .then(response => { if (response.ok) { return response.json(); } - throw Error('Error with request resource response'); + throw { msg: 'Error while sending AccompanyingPeriod Course participation.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body }; }); }; @@ -109,7 +110,7 @@ const postRequestor = (id, payload, method) => { }) .then(response => { if (response.ok) { return response.json(); } - throw Error('Error with request resource response'); + throw { msg: 'Error while sending AccompanyingPeriod Course requestor', sta: response.status, txt: response.statusText, err: new Error(), body: response.body }; }); }; @@ -142,7 +143,7 @@ const postResource = (id, payload, method) => { }) .then(response => { if (response.ok) { return response.json(); } - throw Error('Error with request resource response'); + throw { msg: 'Error while sending AccompanyingPeriod Course resource.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body }; }); }; @@ -161,7 +162,7 @@ const postSocialIssue = (id, body, method) => { }) .then(response => { if (response.ok) { return response.json(); } - throw Error('Error with request resource response'); + throw { msg: 'Error while updating SocialIssue.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body }; }); }; @@ -170,7 +171,7 @@ const getUsers = () => { return fetch(url) .then(response => { if (response.ok) { return response.json(); } - throw Error('Error with request resource response'); + throw { msg: 'Error while retriving users.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body }; }); }; @@ -179,7 +180,7 @@ const whoami = () => { return fetch(url) .then(response => { if (response.ok) { return response.json(); } - throw Error('Error with request resource response'); + throw { msg: 'Error while getting whoami.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body }; }); }; @@ -188,7 +189,7 @@ const getListOrigins = () => { return fetch(url) .then(response => { if (response.ok) { return response.json(); } - throw Error('Error with request resource response'); + throw { msg: 'Error while retriving origin\'s list.', sta: response.status, txt: response.statusText, err: new Error(), body: response.body }; }); } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js index c690534ba..a620a384f 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js @@ -70,7 +70,7 @@ const appMessages = { edit_temporary_address: "Modifier l'adresse temporaire", assign_course_address: "Désigner comme l'adresse du parcours", remove_button: "Enlever l'adresse", - temporary_address_must_be_changed: "Cette addresse est temporaire et doit être remplacée par celle d'un usager de référence.", + temporary_address_must_be_changed: "Cette addresse est temporaire et devrait être remplacée par celle d'un usager de référence.", sure: "Êtes-vous sûr ?", sure_description: "Voulez-vous faire de cette adresse l'adresse du parcours ?", ok: "Désigner comme adresse du parcours", @@ -103,7 +103,18 @@ const appMessages = { sure_description: "Une fois le changement confirmé, il n'est plus possible de le remettre à l'état de brouillon !", ok: "Confirmer le parcours" }, - + // catch errors + 'Error while updating AccompanyingPeriod Course.': "Erreur du serveur lors de la mise à jour du parcours d'accompagnement.", + 'Error while retriving AccompanyingPeriod Course.': "Erreur du serveur lors du chargement du parcours d'accompagnement.", + 'Error while confirming AccompanyingPeriod Course.': "Erreur du serveur lors de la confirmation du parcours d'accompagnement.", + 'Error while retriving Social Issues.': "Erreur du serveur lors du chargement des problématique sociales.", + 'Error while sending AccompanyingPeriod Course participation.': "Erreur du serveur lors de l'envoi des infos d'un usager.", + 'Error while sending AccompanyingPeriod Course requestor': "Erreur du serveur lors de l'envoi des infos du demandeur.", + 'Error while sending AccompanyingPeriod Course resource.': "Erreur du serveur lors de l'envoi des infos d'un interlocuteur privilégié.", + 'Error while updating SocialIssue.': "Erreur du serveur lors de la mise à jour d'une problématique sociale.", + 'Error while retriving users.': "Erreur du serveur lors du chargement de la liste des travailleurs.", + 'Error while getting whoami.': "Erreur du serveur lors de la requête 'qui suis-je ?'", + 'Error while retriving origin\'s list.': "Erreur du serveur lors du chargement de la liste des origines de la demande.", } }; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js index ec2048f31..499b40439 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js @@ -28,6 +28,7 @@ let initPromise = getAccompanyingCourse(id) }, mutations: { catchError(state, error) { + console.log('### mutation: a new error have been catched and pushed in store !', error); state.errorMsg.push(error); }, removeParticipation(state, participation) {