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

check for errors and display success message if ok

parent 877f1d4e
No related branches found
No related tags found
1 merge request!55Anom/redmine ticket 11807 basemap opacity
......@@ -192,7 +192,6 @@ const map = {
return axios
.delete(url)
.then((response) => {
console.log(response)
if (response && response.status === 204) {
commit("REMOVE_BASEMAP_ID_TO_DELETE", basemapId)
return response
......
......@@ -96,24 +96,30 @@ export default {
},
saveChanges() {
// ToDo : check if values are filled
if (this.checkTitles()) {
this.$store
.dispatch("map/SAVE_BASEMAPS", this.newBasemapIds)
.then((res) => {
console.log("res", res);
.then((response) => {
const errors = response.filter(
(res) => res.status !== 200 && res.status !== 204
);
if (errors.length === 0) {
this.newBasemapIds = [];
this.infoMessage = "Enregistrement effectué.";
document
.getElementById("message_info")
.scrollIntoView({ block: "end", inline: "nearest" });
setTimeout(
function () {
this.infoMessage = "";
}.bind(this),
5000
);
}
})
.catch((error) => {
console.log(error);
});
this.newBasemapIds = [];
this.infoMessage = "Enregistrement effectué.";
setTimeout(
function () {
this.infoMessage = "";
}.bind(this),
5000
);
}
},
},
......
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