Skip to content
Snippets Groups Projects
postCredentials.ts 508 B
Newer Older
import axios from 'axios';
import { CredentialsType } from './CredentialsType';

export const postCredentials = 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;
};