Skip to content
Snippets Groups Projects
Commit d517222e authored by Timothee P's avatar Timothee P :sunflower:
Browse files

display info message if offline

parent a2539c88
No related branches found
No related tags found
No related merge requests found
...@@ -180,6 +180,17 @@ export default { ...@@ -180,6 +180,17 @@ export default {
}, },
}, },
watch: {
isOnline(newValue, oldValue) {
if (newValue != oldValue && !newValue) {
this.DISPLAY_MESSAGE({
comment: 'Les signalements du projet non mis en cache ne sont pas accessibles en mode déconnecté',
});
}
},
},
mounted() { mounted() {
if (!this.project) { if (!this.project) {
// Chargements des features et infos projet en cas d'arrivée directe sur la page ou de refresh // Chargements des features et infos projet en cas d'arrivée directe sur la page ou de refresh
...@@ -199,6 +210,9 @@ export default { ...@@ -199,6 +210,9 @@ export default {
}, },
methods: { methods: {
...mapMutations([
'DISPLAY_MESSAGE',
]),
...mapActions('feature', [ ...mapActions('feature', [
'DELETE_FEATURE', 'DELETE_FEATURE',
]), ]),
...@@ -246,7 +260,7 @@ export default { ...@@ -246,7 +260,7 @@ export default {
this.UPDATE_CHECKED_FEATURES(newCheckedFeatures); this.UPDATE_CHECKED_FEATURES(newCheckedFeatures);
this.modifyStatus(newStatus); this.modifyStatus(newStatus);
} else { } else {
this.$store.commit('DISPLAY_MESSAGE', { this.DISPLAY_MESSAGE({
comment: `Le signalement ${feature.title} n'a pas pu être modifié`, comment: `Le signalement ${feature.title} n'a pas pu être modifié`,
level: 'negative' level: 'negative'
}); });
...@@ -256,7 +270,7 @@ export default { ...@@ -256,7 +270,7 @@ export default {
} }
} else { } else {
this.fetchPagedFeatures(); this.fetchPagedFeatures();
this.$store.commit('DISPLAY_MESSAGE', { this.DISPLAY_MESSAGE({
comment: 'Tous les signalements ont été modifié avec succès.', comment: 'Tous les signalements ont été modifié avec succès.',
level: 'positive' level: 'positive'
}); });
...@@ -387,7 +401,12 @@ export default { ...@@ -387,7 +401,12 @@ export default {
}, },
fetchPagedFeatures(newUrl) { fetchPagedFeatures(newUrl) {
if (!this.isOnline) return; if (!navigator.onLine) {
this.DISPLAY_MESSAGE({
comment: 'Les signalements du projet non mis en cache ne sont pas accessibles en mode déconnecté',
});
return;
}
let url = `${this.API_BASE_URL}projects/${this.projectSlug}/feature-paginated/?limit=${this.pagination.pagesize}&offset=${this.pagination.start}`; let url = `${this.API_BASE_URL}projects/${this.projectSlug}/feature-paginated/?limit=${this.pagination.pagesize}&offset=${this.pagination.start}`;
//* if receiving next & previous url (// todo : might be not used anymore, to check) //* if receiving next & previous url (// todo : might be not used anymore, to check)
if (newUrl && typeof newUrl === 'string') { if (newUrl && typeof newUrl === 'string') {
......
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