Skip to content
Snippets Groups Projects
Verified Commit b879392d authored by Defendi Alberto's avatar Defendi Alberto
Browse files

Start rewriting of login request in separate file using async/await.

parent 636453dd
No related branches found
No related tags found
2 merge requests!56Refined auth flow and new website pages.,!44New route type (RestrictedRoute) and better api calls.
import axios from 'axios';
import { CredentialsType } from './CredentialsType';
export const fetchCookie = async (
values: CredentialsType,
cookie: React.Dispatch<React.SetStateAction<string>>,
): Promise<unknown> => {
const response = await axios.post(
'/api/web/login',
{
username: values.username,
password: values.password,
csrfmiddlewaretoken: cookie,
},
{
headers: {
'Content-Type': 'application/json',
},
},
);
return null;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment