Commit | Line | Data |
---|---|---|
a3ac374b BA |
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 | |
f0c68a04 BA |
5 | div(v-if="logoutOk") |
6 | p {{ st.tr["Logout successful!"] }} | |
7 | p {{ st.tr["Back to Hall in 3 seconds..."] }} | |
a3ac374b BA |
8 | </template> |
9 | ||
10 | <script> | |
11 | import { store } from "@/store"; | |
12 | import { ajax } from "@/utils/ajax"; | |
a3ac374b | 13 | export default { |
6808d7a1 | 14 | name: "my-logout", |
a3ac374b BA |
15 | data: function() { |
16 | return { | |
f0c68a04 BA |
17 | st: store.state, |
18 | logoutOk: false | |
a3ac374b BA |
19 | }; |
20 | }, | |
21 | created: function() { | |
910d631b BA |
22 | ajax( |
23 | "/logout", | |
24 | "GET", | |
25 | () => { | |
f0c68a04 | 26 | this.logoutOk = true; |
910d631b BA |
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"); | |
f0c68a04 BA |
33 | setTimeout(() => { |
34 | this.$router.replace("/"); | |
35 | }, 3000); | |
910d631b BA |
36 | } |
37 | ); | |
6808d7a1 | 38 | } |
a3ac374b BA |
39 | }; |
40 | </script> |