Add Oudelaa dashboard API integration
فشلت بعض الفحوصات
Deploy To Ghaymah / deploy (push) Has been cancelled
فشلت بعض الفحوصات
Deploy To Ghaymah / deploy (push) Has been cancelled
هذا الالتزام موجود في:
34
oudelaa_dashboard/lib/api/auth.ts
Normal file
34
oudelaa_dashboard/lib/api/auth.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { apiEndpoints } from "@/lib/api/endpoints";
|
||||
import { fetchWithAuth } from "@/lib/auth/client";
|
||||
import type { LoginResponse, SessionsResponse, SuccessMessage } from "@/types/api";
|
||||
|
||||
export async function loginDashboardUser(email: string, password: string) {
|
||||
return fetchWithAuth<LoginResponse>(apiEndpoints.auth.login, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ email, password }),
|
||||
});
|
||||
}
|
||||
|
||||
export async function refreshDashboardUser(refreshToken: string) {
|
||||
return fetchWithAuth<LoginResponse>(apiEndpoints.auth.refresh, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ refreshToken }),
|
||||
});
|
||||
}
|
||||
|
||||
export async function logoutDashboardUser(refreshToken: string) {
|
||||
return fetchWithAuth<SuccessMessage>(apiEndpoints.auth.logout, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ refreshToken }),
|
||||
});
|
||||
}
|
||||
|
||||
export async function listSuperAdminSessions() {
|
||||
return fetchWithAuth<SessionsResponse>(apiEndpoints.auth.superAdminSessions);
|
||||
}
|
||||
|
||||
export async function revokeSuperAdminSession(sessionId: string) {
|
||||
return fetchWithAuth<SuccessMessage>(apiEndpoints.auth.revokeSuperAdminSession(sessionId), {
|
||||
method: "POST",
|
||||
});
|
||||
}
|
||||
المرجع في مشكلة جديدة
حظر مستخدم