From 27a774aed70e98901fb36300819c34b33b2f31f7 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sat, 29 Jan 2022 20:35:23 -0800 Subject: [PATCH] Update api.tsx --- utils/api.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/api.tsx b/utils/api.tsx index f41b8363..334e3dcd 100644 --- a/utils/api.tsx +++ b/utils/api.tsx @@ -46,7 +46,8 @@ class Api { } login(object: {}) { - return axios.post(`${ process.env.REACT_APP_SIERO_OAUTH_URL }/token`, object) + const oauthUrl = (process.env.REACT_APP_SIERO_OAUTH_URL) ? process.env.REACT_APP_SIERO_OAUTH_URL : 'http://127.0.0.1:3000/oauth' + return axios.post(`${ oauthUrl }/token`, object) } search(object: string, query: string, excludes: string) { @@ -65,7 +66,8 @@ class Api { } } -const api: Api = new Api({ url: process.env.REACT_APP_SIERO_API_URL }) +const apiUrl = (process.env.REACT_APP_SIERO_API_URL) ? process.env.REACT_APP_SIERO_API_URL : 'http://127.0.0.1:3000/api/v1' +const api: Api = new Api({ url: apiUrl }) api.createEntity( { name: 'users' }) api.createEntity( { name: 'parties' }) api.createEntity( { name: 'characters' })