Ensure uniform code formatting across components by aligning with the established code style. Adjust imports, indentation, and spacing to enhance readability and maintainability.
25 lines
571 B
TypeScript
25 lines
571 B
TypeScript
import api from "@/lib/api";
|
|
import type { LoginResponse, RegisterPayload } from "@/types/auth";
|
|
|
|
export const AuthService = {
|
|
async login(email: string, password: string): Promise<LoginResponse> {
|
|
const { data } = await api.post<LoginResponse>("/auth/login", {
|
|
email,
|
|
password,
|
|
});
|
|
return data;
|
|
},
|
|
|
|
async register(payload: RegisterPayload): Promise<void> {
|
|
await api.post("/auth/register", payload);
|
|
},
|
|
|
|
async logout(): Promise<void> {
|
|
await api.post("/auth/logout");
|
|
},
|
|
|
|
async refresh(): Promise<void> {
|
|
await api.post("/auth/refresh");
|
|
},
|
|
};
|