Files
iddaai-fe/src/lib/api/auth/service.ts
T
fahricansecer 5c8619b282
Deploy Iddaai Frontend / build-and-deploy (push) Failing after 34s
gg
2026-05-10 22:59:27 +03:00

46 lines
935 B
TypeScript

import { apiRequest } from "@/lib/api/api-service";
import { ApiResponse } from "@/types/api-response";
import { LoginDto, AuthResponse, RegisterDto, RefreshTokenDto } from "./types";
const login = (data: LoginDto) => {
return apiRequest<ApiResponse<AuthResponse>>({
url: "/auth/login",
client: "auth",
method: "post",
data,
});
};
const register = (data: RegisterDto) => {
return apiRequest<ApiResponse<AuthResponse>>({
url: "/auth/register",
client: "auth",
method: "post",
data,
});
};
const refreshToken = (data: RefreshTokenDto) => {
return apiRequest<ApiResponse<AuthResponse>>({
url: "/auth/refresh",
client: "auth",
method: "post",
data,
});
};
const logout = () => {
return apiRequest<ApiResponse<null>>({
url: "/auth/logout",
client: "auth",
method: "post",
});
};
export const authService = {
login,
register,
refreshToken,
logout,
};