Skip to content

Commit

Permalink
fix: reviewing router logic on landing page to set redirection with e…
Browse files Browse the repository at this point in the history
…nv.url
  • Loading branch information
BrianRid committed Jul 7, 2021
1 parent 3814bb2 commit 68ec854
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions tumeplay-app/environnements/env.dev.guyane
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
REACT_APP_API_URL=http://localhost:1337
REACT_APP_ZONE=guyane
REACT_APP_OTHER_ZONE_URL=https://tumeplay.numericite.fr
1 change: 1 addition & 0 deletions tumeplay-app/environnements/env.dev.metropole
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
REACT_APP_API_URL=http://localhost:1337
REACT_APP_ZONE=metropole
REACT_APP_OTHER_ZONE_URL=https://guyane.tumeplay.numericite.fr
1 change: 1 addition & 0 deletions tumeplay-app/environnements/env.preprod.guyane
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
REACT_APP_API_URL=https://bo.tumeplay.numericite.fr
REACT_APP_ZONE=guyane
REACT_APP_OTHER_ZONE_URL=https://tumeplay.numericite.fr
1 change: 1 addition & 0 deletions tumeplay-app/environnements/env.preprod.metropole
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
REACT_APP_API_URL=https://bo.tumeplay.numericite.fr
REACT_APP_ZONE=metropole
REACT_APP_OTHER_ZONE_URL=https://guyane.tumeplay.numericite.fr
2 changes: 1 addition & 1 deletion tumeplay-app/src/routes/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const AppStack = createStackNavigator(
},
},
{
initialRouteName: process.env.REACT_APP_ZONE === 'guyane' ? 'LandingScreen' : 'LandingPage',
initialRouteName: 'LandingPage',
headerLayoutPreset: 'center',
defaultNavigationOptions: ({navigation}) => ({
header: <CustomHeader navigation={navigation} />,
Expand Down
14 changes: 11 additions & 3 deletions tumeplay-app/src/screens/LandingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@ const LandingPage = (props) => {
const guyane = require('../assets/pictures/Guyane.png')

const handleRedirection = (name) => {
if(name === 'guyane') {
window.location.href = 'https://guyane.tumeplay.numericite.fr/'
} else {
if(process.env.REACT_APP_ZONE === 'metropole' && name === 'guyane') {
window.location.href = process.env.REACT_APP_OTHER_ZONE_URL
}
if(process.env.REACT_APP_ZONE === 'metropole' && name === 'metropole') {
props.navigation.navigate('LandingScreen')
}
if(process.env.REACT_APP_ZONE === 'guyane' && name === 'metropole') {
console.log(process.env.REACT_APP_OTHER_ZONE_URL)
window.location.href = process.env.REACT_APP_OTHER_ZONE_URL
}
if(process.env.REACT_APP_ZONE === 'guyane' && name === 'guyane') {
props.navigation.navigate('LandingScreen')
}
}
Expand Down

0 comments on commit 68ec854

Please sign in to comment.