# HG changeset patch # User Thomas Junk # Date 1568273027 -7200 # Node ID f0be2aec953a711fd17434e9956366b7541291c0 # Parent 09406e3b052ca2f7cc8c9430afa477bd0ed6a2fd logout: Logging out triggers a request to log the user out on server side diff -r 09406e3b052c -r f0be2aec953a client/src/lib/session.js --- a/client/src/lib/session.js Wed Sep 11 16:30:25 2019 +0200 +++ b/client/src/lib/session.js Thu Sep 12 09:23:47 2019 +0200 @@ -14,13 +14,30 @@ import app from "@/main"; import { unsetLayerConfigs } from "@/components/map/layers"; +import { HTTP } from "@/lib/http"; +import { displayError } from "@/lib/errors"; const logOff = () => { - app.$snotify.clear(); - app.$store.commit("reset"); - app.$store.commit("user/clearAuth"); - app.$router.push("/login"); - unsetLayerConfigs(); + HTTP.get("/logout", { + headers: { + "X-Gemma-Auth": localStorage.getItem("token"), + "Content-type": "text/xml; charset=UTF-8" + } + }) + .then(() => { + app.$snotify.clear(); + app.$store.commit("reset"); + app.$store.commit("user/clearAuth"); + app.$router.push("/login"); + unsetLayerConfigs(); + }) + .catch(error => { + const { status, data } = error.response; + displayError({ + title: this.$gettext("Backend Error"), + message: `${status}: ${data.message || data}` + }); + }); }; /**