This commit is contained in:
Giovanni Rezcjikov
2026-03-10 20:00:58 +03:00
parent d7615b4eb0
commit 77d429c8ba
31 changed files with 1098 additions and 504 deletions
+5 -5
View File
@@ -97,7 +97,7 @@ export async function SessionLogin(
}
}
export async function GetUser(): Promise<User | null> {
export async function fetchUser(): Promise<User | null> {
const store = await cookies();
const accessToken = store.get("access_token")?.value;
if (!accessToken) return null;
@@ -114,7 +114,7 @@ export async function GetUser(): Promise<User | null> {
await clearTokens();
return null;
}
return GetUser();
return fetchUser();
}
if (!response.ok) return null;
@@ -124,7 +124,7 @@ export async function GetUser(): Promise<User | null> {
}
}
export async function UpdateUser(first_name: string, second_name: string, birth_date: string): Promise<User | null> {
export async function updateUser(first_name: string, second_name: string, birth_date: string): Promise<User | null> {
const store = await cookies();
const accessToken = store.get("access_token")?.value;
if (!accessToken) return null;
@@ -155,7 +155,7 @@ export async function UpdateUser(first_name: string, second_name: string, birth_
await clearTokens();
return null;
}
return UpdateUser(first_name, second_name, birth_date);
return updateUser(first_name, second_name, birth_date);
}
if (!response.ok) return null;
@@ -165,7 +165,7 @@ export async function UpdateUser(first_name: string, second_name: string, birth_
}
}
export async function Register(email: string, password: string, first_name: string, second_name: string, sex: string): Promise<{ success: boolean; redirectURL?: string; expired?: boolean; message?: string }> {
export async function registerUser(email: string, password: string, first_name: string, second_name: string, sex: string): Promise<{ success: boolean; redirectURL?: string; expired?: boolean; message?: string }> {
const t = await getTranslations("errors");
if (!email || !password) return { success: false, message: t("allFieldsRequired") }