From 26d040a6b12ef2771cab8a022e4b92c3c461ed08 Mon Sep 17 00:00:00 2001 From: hay-kot Date: Sun, 21 Feb 2021 20:42:04 -0900 Subject: [PATCH] token request --- frontend/src/api/index.js | 2 ++ frontend/src/api/users.js | 23 +++++++++++++++++++++ frontend/src/components/Login/LoginForm.vue | 10 +++++++-- frontend/src/components/UI/AddRecipeFab.vue | 20 +++++++++++++++--- 4 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 frontend/src/api/users.js diff --git a/frontend/src/api/index.js b/frontend/src/api/index.js index adb20277c..0082dba12 100644 --- a/frontend/src/api/index.js +++ b/frontend/src/api/index.js @@ -7,6 +7,7 @@ import migration from "./migration"; import myUtils from "./upload"; import category from "./category"; import meta from "./meta"; +import users from "./users" export default { @@ -19,4 +20,5 @@ export default { utils: myUtils, categories: category, meta: meta, + users: users }; diff --git a/frontend/src/api/users.js b/frontend/src/api/users.js new file mode 100644 index 000000000..e3f1d0aca --- /dev/null +++ b/frontend/src/api/users.js @@ -0,0 +1,23 @@ +import { baseURL } from "./api-utils"; +import { apiReq } from "./api-utils"; +const authPrefix = baseURL + "auth/"; + +const authURLs = { + token: `${authPrefix}token`, +}; + +// const usersURLs = { + +// } + +export default { + async login(formData) { + let response = await apiReq.post(authURLs.token, formData, { + headers: { + "Content-Type": "application/x-www-form-urlencoded", + }, + }); + console.log(response); + return response.data; + }, +}; diff --git a/frontend/src/components/Login/LoginForm.vue b/frontend/src/components/Login/LoginForm.vue index 4d7f3db95..f0a981974 100644 --- a/frontend/src/components/Login/LoginForm.vue +++ b/frontend/src/components/Login/LoginForm.vue @@ -32,7 +32,9 @@ light="light" prepend-icon="mdi-lock" :label="$t('login.password')" - type="password" + :type="showPassword ? 'text' : 'password'" + :append-icon="showPassword ? 'mdi-eye' : 'mdi-eye-off'" + @click:append="showPassword = !showPassword" > - - + + mdi-link + + + {{ $t("new-recipe.from-url") }} @@ -40,7 +49,12 @@ {{ $t("general.close") }} - + {{ $t("general.submit") }}