import AppConfig from '../app/AppConfig'; import { ApiEndpoint, ApiEnvelope } from '../request/RequestTypes'; export const API_BASE_PREFIX = 'game/'; export const API_BASE_URL = AppConfig.IsDebugEnv ? AppConfig.TestApiUrl : AppConfig.MainApiUrl; export const API_BASE_WS = AppConfig.IsDebugEnv ? AppConfig.TestWsUrl : AppConfig.MainWsUrl; export const get = (path: string): ApiEndpoint => ({ method: 'GET', path }); export const post = (path: string): ApiEndpoint => ({ method: 'POST', path }); export const API_CODE_SUCCESS = 200; export const success = (res: ApiEnvelope) => { return res && (res.code === 0 || res.code === 200); }