Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
fix(app): change app flag to use window location hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
rhahao committed Feb 6, 2022
1 parent 5163ad3 commit aa0cee1
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,23 @@ const App = () => {
if (!process.env.NODE_ENV || process.env.NODE_ENV === 'development') {
setApiHost('http://localhost:8000/');
} else {
console.log(process.env.APP_FLAG);
if (process.env.APP_FLAG === 'development') {
console.log(window.location.hostname);

const appUrl = window.location.hostname;
if (
appUrl === 'dev-lmm-oa-sws.web.app' ||
appUrl === 'dev-lmm-oa-sws.firebaseapp.com'
) {
setApiHost('https://dev-sws2apps.herokuapp.com/');
} else if (process.env.APP_FLAG === 'development') {
} else if (
appUrl === 'staging-lmm-oa-sws.web.app' ||
appUrl === 'staging-lmm-oa-sws.firebaseapp.com'
) {
setApiHost('https://staging-sws2apps.herokuapp.com/');
} else if (process.env.APP_FLAG === 'production') {
} else if (
appUrl === 'lmm-oa-sws.web.app' ||
appUrl === 'lmm-oa-sws.firebaseapp.com'
) {
setApiHost('https://dev-sws2apps.herokuapp.com/');
}
}
Expand Down

0 comments on commit aa0cee1

Please sign in to comment.