From d0716a0ad16ca3c555be3276361501a5484b7804 Mon Sep 17 00:00:00 2001 From: jhynsoo Date: Tue, 14 Nov 2023 02:35:15 +0900 Subject: [PATCH] fix: Add csrf token to login page --- src/components/Login/LoginForm.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Login/LoginForm.jsx b/src/components/Login/LoginForm.jsx index 6b2e8d2..b24504d 100644 --- a/src/components/Login/LoginForm.jsx +++ b/src/components/Login/LoginForm.jsx @@ -2,11 +2,12 @@ import { API, URL, getCookie } from '../../API'; import * as S from '../../styles/Form.styles'; import { useState } from 'react'; import CSRFToken from '../CSRFToken/CSRFToken'; -import { Navigate, useNavigate } from 'react-router-dom'; +import { useNavigate } from 'react-router-dom'; import useIsLogged from '../../hooks/network/isLogged'; const LoginForm = () => { const navigate = useNavigate(); + const csrfToken = getCookie('csrftoken'); const setIsLogged = useIsLogged((state) => state.setIsLogged); const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); @@ -15,6 +16,7 @@ const LoginForm = () => { API.post(URL.login, { username, password, + csrfmiddlewaretoken: csrfToken, }) .then((res) => { if (res.status === 200) {