me page update

This commit is contained in:
leejinseok
2020-02-14 16:38:27 +09:00
parent 68d7abb776
commit edb911d6d7

View File

@@ -20,7 +20,7 @@
</template> </template>
<script> <script>
import authApi from "../../api/authApi"; import authService from "../../services/authService";
export default { export default {
name: "Info", name: "Info",
@@ -31,10 +31,14 @@
}; };
}, },
async beforeCreate() { async beforeCreate() {
authApi.bind(this); authService.session = authService.session.bind(this);
authService.banishIfUserUnAuthenticated = authService.banishIfUserUnAuthenticated.bind(this);
},
async created() {
await authService.banishIfUserUnAuthenticated();
try { try {
const {data} = await authApi.session(); const {data} = await authService.session();
this.user = data; this.user = data;
} catch (err) { } catch (err) {
await this.$router.replace("/auth/login"); await this.$router.replace("/auth/login");