Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
17 lines
378 B
TypeScript
17 lines
378 B
TypeScript
export interface ApiSuccessBody<T> {
|
|
success: true
|
|
body?: T
|
|
data?: T
|
|
message?: string
|
|
}
|
|
|
|
export interface ApiErrorBody {
|
|
success: false
|
|
message: string
|
|
code?: string
|
|
}
|
|
|
|
export type ApiResponse<T> = ApiSuccessBody<T> | ApiErrorBody
|
|
|
|
export const unwrapApiData = <T>(payload: { success?: boolean; data?: T; body?: T }): T | undefined => payload.data ?? payload.body
|