chore(FE-40): move api.d.ts to /types/api/api-general.d.ts

This commit is contained in:
ValdiANS
2025-10-01 13:56:59 +07:00
parent 8206f7de5f
commit 6969a2bcb8
+39
View File
@@ -0,0 +1,39 @@
type ErrorApiResponse = {
code: number;
status: 'error';
message: string;
errors?: { [key: string]: string };
};
type SuccessApiResponse<T = unknown> = {
code: number;
status: 'success';
message: string;
meta?: {
page: number;
limit: number;
total_pages: number;
total_results: number;
};
data: T;
};
type BaseApiResponse<T = unknown> = ErrorApiResponse | SuccessApiResponse<T>;
export type LogoutResponse = BaseApiResponse;
export type GetMeResponse = BaseApiResponse<UserWithRoles>;
export type User = {
id: number;
email: string;
npk: string;
name: string;
image?: string | null;
created_at: string;
updated_at: string;
};
export type UserWithRoles = User & {
roles: RoleWithPermissions[];
};