From 4ac8eb0402908d94ba18d8657e7fbe9f6a1792d4 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Mon, 4 Nov 2019 22:29:19 +0900 Subject: [PATCH] Add auth service to remove hard coded url from auth store --- frontend/components/organisms/auth/LoginForm.vue | 1 + frontend/services/api.service.js | 4 ---- frontend/services/auth.service.js | 13 +++++++++++++ frontend/store/auth.js | 5 ++--- 4 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 frontend/services/auth.service.js diff --git a/frontend/components/organisms/auth/LoginForm.vue b/frontend/components/organisms/auth/LoginForm.vue index 8b2a81e0..76138562 100644 --- a/frontend/components/organisms/auth/LoginForm.vue +++ b/frontend/components/organisms/auth/LoginForm.vue @@ -17,6 +17,7 @@ name="login" prepend-icon="person" type="text" + autofocus /> ({ token: null @@ -22,9 +23,7 @@ export const getters = { export const actions = { authenticateUser({ commit }, authData) { - const authUrl = 'http://127.0.0.1:8000/v1/auth-token' - return this.$axios - .$post(authUrl, authData) + return AuthService.postCredential(authData) .then((result) => { commit('setToken', result.token) localStorage.setItem('token', result.token)