From 8daa979ca75ff02cba87f05086ed19b635a48293 Mon Sep 17 00:00:00 2001 From: amalv <1252707+amalv@users.noreply.github.com> Date: Tue, 9 Jan 2024 09:30:30 +0100 Subject: [PATCH] feat: add staging environment check for Auth0 redirect URI --- .github/workflows/test.yml | 1 + src/App.tsx | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bcba2b7..f29faeb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,7 @@ jobs: VITE_API_URL_PRODUCTION: ${{ secrets.VITE_API_URL_PRODUCTION }} VITE_AUTH0_DOMAIN: ${{ secrets.VITE_AUTH0_DOMAIN_STAGING }} VITE_AUTH0_CLIENT_ID: ${{ secrets.VITE_AUTH0_CLIENT_ID_STAGING }} + VITE_ENV: staging - name: Deploy to Netlify id: deploy uses: nwtgck/actions-netlify@v2.0 diff --git a/src/App.tsx b/src/App.tsx index 74cf6bf..889ada3 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,9 +8,11 @@ import { client } from "./apolloClient"; const getRedirectUri = () => { const isProduction = process.env.NODE_ENV === "production"; - return isProduction - ? `${window.location.origin}/bukie` - : window.location.origin; + const isStaging = import.meta.env.VITE_ENV === "staging"; + if (isProduction && !isStaging) { + return `${window.location.origin}/bukie`; + } + return window.location.origin; }; const App = () => { const theme = useTheme();