Updated axios request object, added minio

This commit is contained in:
Benjamin Sherriff
2023-10-19 16:55:13 -04:00
parent 55b8b1a0e3
commit f46748167c
9 changed files with 65 additions and 18 deletions

View File

@@ -2,7 +2,7 @@ import { getRequest, postRequest } from '.';
import { RegisterUser, ResponseAuth } from './auth.types';
export async function login(email: string, password: string): Promise<ResponseAuth | undefined> {
const response = await postRequest('auth/login', { email, password }, { withCredentials: true });
const response = await postRequest('auth/login', { email, password });
if (response?.status === 200) {
return response.data as ResponseAuth;
} else {
@@ -11,7 +11,7 @@ export async function login(email: string, password: string): Promise<ResponseAu
}
export async function register(user: RegisterUser): Promise<boolean> {
const response = await postRequest('auth/register', user, { withCredentials: true });
const response = await postRequest('auth/register', user);
if (response?.status === 201) {
return true;
} else {
@@ -20,11 +20,11 @@ export async function register(user: RegisterUser): Promise<boolean> {
}
export async function logout() {
return await postRequest('auth/logout', {}, { withCredentials: true });
return await postRequest('auth/logout', {});
}
export async function refresh(refresh_token_rotation?: boolean): Promise<ResponseAuth | undefined> {
const response = await getRequest('auth/refresh', { withCredentials: true, params: { refresh_token_rotation } });
const response = await getRequest('auth/refresh', { params: { refresh_token_rotation } });
if (response?.status === 200) {
return response.data as ResponseAuth;
} else {
@@ -33,7 +33,7 @@ export async function refresh(refresh_token_rotation?: boolean): Promise<Respons
}
export async function me(): Promise<ResponseAuth | undefined> {
const response = await getRequest('auth/me', { withCredentials: true });
const response = await getRequest('auth/me');
if (response?.status === 200) {
return response.data;
} else {