diff --git a/package.json b/package.json index 065d1fbf..dd1f4b04 100644 --- a/package.json +++ b/package.json @@ -70,18 +70,12 @@ "scripts": { "precommit": "lint-staged", "flow": "flow", - "start": "react-scripts start", + "start": "REACT_APP_STACK=DEV react-scripts start", "lint": "eslint src", "test": "npm run lint && react-scripts test --env=jsdom", "coverage": "react-scripts test --env=jsdom --coverage", "build": "REACT_APP_VERSION=\"$(node -e \"console.log(require('./package.json').version)\")\" REACT_APP_STACK=DEV react-scripts build", - "build:dev": "REACT_APP_VERSION=\"$(node -e \"console.log(require('./package.json').version)\")\" REACT_APP_STACK=DEV PUBLIC_URL=https://mapbox.github.io/osmcha-frontend react-scripts build", - "deploy:dev": "gh-pages -d build", - "build:staging": "REACT_APP_VERSION=\"$(node -e \"console.log(require('./package.json').version)\")\" REACT_APP_STACK=STAGING PUBLIC_URL=https://staging.osmcha.org react-scripts build", - "deploy:staging": "gh-pages -d build -b oh-pages", - "build:prod": "REACT_APP_VERSION=\"$(node -e \"console.log(require('./package.json').version)\")\" REACT_APP_STACK=PRODUCTION PUBLIC_URL=https://osmcha.org react-scripts build", - "deploy:prod": "gh-pages -d build -b oh-pages", - "build:test": "REACT_APP_VERSION=\"$(node -e \"console.log(require('./package.json').version)\")\" REACT_APP_STACK=PRODUCTION PUBLIC_URL=https://osmcha-test.ds.io react-scripts build" + "build:prod": "REACT_APP_VERSION=\"$(node -e \"console.log(require('./package.json').version)\")\" REACT_APP_STACK=PRODUCTION PUBLIC_URL=https://osmcha.org react-scripts build" }, "lint-staged": { "*.js": [ diff --git a/src/views/navbar_sidebar.js b/src/views/navbar_sidebar.js index 7a7278f3..94b1f107 100644 --- a/src/views/navbar_sidebar.js +++ b/src/views/navbar_sidebar.js @@ -34,7 +34,14 @@ class NavbarSidebar extends React.PureComponent { handleLoginClick = () => { getAuthUrl().then(res => { - window.location.assign(res.auth_url); + const authUrl = new URL(res.auth_url); + if (process.env.REACT_APP_STACK === 'DEV') { + authUrl.searchParams.set( + 'redirect_uri', + 'http://127.0.0.1:3000/authorized' + ); + } + window.location.assign(authUrl.href); }); };