From 069ff795bc3d1e44f6e6a8deddb0363d1ec3168f Mon Sep 17 00:00:00 2001 From: Patryk <43276401+Zaptyp@users.noreply.github.com> Date: Thu, 3 Feb 2022 09:59:38 +0100 Subject: [PATCH] Fix login page (#80) Co-authored-by: Marioneq Co-authored-by: Zaptyp <43276401+Zaptyp@users.noreply.github.com> --- frontend/src/api/login.ts | 10 +-- frontend/src/components/Login/UserLogin.vue | 80 ++++++++++----------- frontend/tsconfig.json | 1 + 3 files changed, 43 insertions(+), 48 deletions(-) diff --git a/frontend/src/api/login.ts b/frontend/src/api/login.ts index db22654..1d98d35 100644 --- a/frontend/src/api/login.ts +++ b/frontend/src/api/login.ts @@ -2,21 +2,23 @@ import axios, { AxiosResponse } from 'axios'; import Cookies from 'universal-cookie'; export default { - register: async (email: string, password: string, symbol: string): Promise => { + login: async (email: string, password: string, symbol: string, diaryUrl: string) + : Promise => { const cookies = new Cookies(); const response = await axios({ - method: 'post', + method: 'POST', url: 'http://localhost:8000/api/login', headers: { 'Content-Type': 'application/json', - 'X-CSRFToken': cookies.get('csrf-token'), + 'X-CSRFToken': cookies.get('csrftoken'), }, data: { loginName: email, Password: password, Symbol: symbol, - diaryUrl: 'http://cufs.fakelog.tk/', + diaryUrl, }, + withCredentials: true, }); document.cookie = response.headers['Set-Cookie']; diff --git a/frontend/src/components/Login/UserLogin.vue b/frontend/src/components/Login/UserLogin.vue index cc2c0c7..b2e65dd 100644 --- a/frontend/src/components/Login/UserLogin.vue +++ b/frontend/src/components/Login/UserLogin.vue @@ -30,12 +30,14 @@ /> @@ -50,64 +52,54 @@ - - diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 25566f5..78fd4a9 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -7,6 +7,7 @@ "importHelpers": true, "moduleResolution": "node", "skipLibCheck": true, + "resolveJsonModule": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "sourceMap": true,