Skip to content

Commit

Permalink
change: ApiSucessResponse and ApiFailResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
NiiMiyo committed Dec 2, 2023
1 parent d2444df commit 7cc6c2c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/types/UniversimeApi.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
export type ApiResponse<ResponseBody = undefined> = {
success: boolean;
type ApiBaseResponse<Success extends boolean, ResponseBody = undefined> = {
success: Success;
message?: string;
redirectTo?: string;
token?: string;
body?: ResponseBody;
alertOptions?: any;
body: ResponseBody;
alertOptions?: {
[k: string]: string;
};
};

export type ApiSuccessResponse<SuccessBody> = ApiBaseResponse<true, SuccessBody>;
export type ApiFailResponse<FailBody> = ApiBaseResponse<false, FailBody>;

export type ApiResponse<SuccessBody = undefined, FailBody = undefined>
= ApiSuccessResponse<SuccessBody> | ApiFailResponse<FailBody>;

0 comments on commit 7cc6c2c

Please sign in to comment.