Fixed refresh missing email issue
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { getRequest, postRequest } from '.';
|
||||
import { RegisterUser, ResponseUser } from './auth.types';
|
||||
import { RegisterUser, ResponseAuth } from './auth.types';
|
||||
|
||||
export async function login(email: string, password: string): Promise<ResponseUser | undefined> {
|
||||
export async function login(email: string, password: string): Promise<ResponseAuth | undefined> {
|
||||
const response = await postRequest('auth/login', { email, password }, { withCredentials: true });
|
||||
if (response?.status === 200) {
|
||||
return response.data as ResponseUser;
|
||||
return response.data as ResponseAuth;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
@@ -23,16 +23,16 @@ export async function logout() {
|
||||
return await postRequest('auth/logout', {}, { withCredentials: true });
|
||||
}
|
||||
|
||||
export async function refresh(refresh_token_rotation?: boolean): Promise<ResponseUser | undefined> {
|
||||
export async function refresh(refresh_token_rotation?: boolean): Promise<ResponseAuth | undefined> {
|
||||
const response = await getRequest('auth/refresh', { withCredentials: true, params: { refresh_token_rotation } });
|
||||
if (response?.status === 200) {
|
||||
return response.data as ResponseUser;
|
||||
return response.data as ResponseAuth;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export async function me(): Promise<ResponseUser | undefined> {
|
||||
export async function me(): Promise<ResponseAuth | undefined> {
|
||||
const response = await getRequest('auth/me', { withCredentials: true });
|
||||
if (response?.status === 200) {
|
||||
return response.data;
|
||||
|
||||
Reference in New Issue
Block a user