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="authOk") |
6 | p {{ st.tr["Authentication successful!"] }} | |
a3ac374b BA |
7 | </template> |
8 | ||
9 | <script> | |
10 | import { store } from "@/store"; | |
11 | import { ajax } from "@/utils/ajax"; | |
a3ac374b | 12 | export default { |
6808d7a1 | 13 | name: "my-auth", |
a3ac374b BA |
14 | data: function() { |
15 | return { | |
f0c68a04 BA |
16 | st: store.state, |
17 | authOk: false | |
a3ac374b BA |
18 | }; |
19 | }, | |
20 | created: function() { | |
6808d7a1 BA |
21 | ajax( |
22 | "/authenticate", | |
23 | "GET", | |
e57c4de4 BA |
24 | { |
25 | credentials: true, | |
26 | data: { token: this.$route.params["token"] }, | |
27 | success: (res) => { | |
28 | this.authOk = true; | |
29 | this.st.user.id = res.id; | |
30 | this.st.user.name = res.name; | |
31 | this.st.user.email = res.email; | |
32 | this.st.user.notify = res.notify; | |
33 | localStorage["myname"] = res.name; | |
34 | localStorage["myid"] = res.id; | |
35 | } | |
6808d7a1 | 36 | } |
a3ac374b | 37 | ); |
6808d7a1 | 38 | } |
a3ac374b BA |
39 | }; |
40 | </script> |