From b684656379d461f6d142559827e2d19442c68a46 Mon Sep 17 00:00:00 2001 From: Taso Date: Wed, 14 Apr 2021 17:52:38 -0400 Subject: [PATCH] feat(server/types): Play around with a standardized resp type --- typings/phone.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/typings/phone.ts b/typings/phone.ts index 7de8f12..3504c61 100644 --- a/typings/phone.ts +++ b/typings/phone.ts @@ -20,3 +20,25 @@ export enum PhoneEvents { SET_TIME = 'npwd:setGameTime', SEND_CREDENTIALS = 'npwd:sendCredentials', } + +// Used to standardize the server response +export enum ErrorStringKeys { + SERVER_ERROR = 'GENERAL_SERVER_ERROR', + DELETE_FAILED = 'DELETE_FAILED', + ADD_FAILED = 'ADD_FAILED', + UPDATE_FAILED = 'UPDATED_FAILED', + FETCH_FAILED = 'FETCH_FAILED', +} + +export interface FxServerRespError { + errorKey: ErrorStringKeys; + message: string; +} + +export interface FxServerResponse { + data?: unknown; + action: string; + status: 'success' | 'failure'; + app: string; + error?: FxServerRespError; +}