1740c7daebc403bc8bf1fb437386c5096325d0e5
[vchess.git] / client / src / views / Logout.vue
1 <template lang="pug">
2 main
3 .row
4 .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
5 div(v-if="logoutOk")
6 p {{ st.tr["Logout successful!"] }}
7 p {{ st.tr["Back to Hall in 3 seconds..."] }}
8 </template>
9
10 <script>
11 import { store } from "@/store";
12 import { ajax } from "@/utils/ajax";
13 export default {
14 name: "my-logout",
15 data: function() {
16 return {
17 st: store.state,
18 logoutOk: false
19 };
20 },
21 created: function() {
22 ajax(
23 "/logout",
24 "GET",
25 () => {
26 this.logoutOk = true;
27 this.st.user.id = 0;
28 this.st.user.name = "";
29 this.st.user.email = "";
30 this.st.user.notify = false;
31 localStorage.removeItem("myid");
32 localStorage.removeItem("myname");
33 setTimeout(() => {
34 this.$router.replace("/");
35 }, 3000);
36 }
37 );
38 }
39 };
40 </script>