Created
June 5, 2022 09:44
Revisions
-
JanPlazovnik created this gist
Jun 5, 2022 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ export interface ApiResponse { status: 'success' | 'fail' | 'error'; data?: any; message?: any; } export class jsend { // https://github.com/omniti-labs/jsend public static success(data: any): ApiResponse { return { status: 'success', data, }; } public static fail(data: any): ApiResponse { return { status: 'fail', data, }; } public static error(message: string | null, data?: any): ApiResponse { return { status: 'error', message, data, }; } }