Skip to content

Commit

Permalink
Merge pull request #300 from universi-me/change#294/incrementar-api-r…
Browse files Browse the repository at this point in the history
…esponse

CHANGE #294: Incrementar ApiResponse
  • Loading branch information
NiiMiyo authored Dec 6, 2023
2 parents b7b9471 + 7cc6c2c commit 3d47600
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 3d47600

Please sign in to comment.