diff --git a/backend/vercel.json b/backend/vercel.json index 1b206ef7..6df00e01 100644 --- a/backend/vercel.json +++ b/backend/vercel.json @@ -11,5 +11,6 @@ "source": "/frontend/:match*", "destination": "https://monorepo-test-frontend-neon.vercel.app/:match*" } - ] + ], + "relatedProjects": ["prj_emQEOHSrnlodZCgZ1kyzVsiiGSQm"] } \ No newline at end of file diff --git a/frontend/frontend/src/constants.js b/frontend/frontend/src/constants.js index f690c98a..df76f007 100644 --- a/frontend/frontend/src/constants.js +++ b/frontend/frontend/src/constants.js @@ -9,12 +9,16 @@ export const CLIENT_ID = PROD export const MODE = process.env.REACT_APP_MODE; +export const HOST = PROD + ? 'monorepo-test-backend-seven.vercel.app' + : 'localhost:3000'; + export const REDIRECT_URI = PROD ? MODE === 'trends' - ? 'https://www.githubtrends.io/user' + ? `https://${HOST}/frontend/user` : 'https://www.githubtrends.io/user/wrapped' : MODE === 'trends' - ? 'http://localhost:3000/user' + ? `http://${HOST}/frontend/user` : 'http://localhost:3000/user/wrapped'; export const GITHUB_PRIVATE_AUTH_URL = `https://github.com/login/oauth/authorize?scope=user,repo&client_id=${CLIENT_ID}&redirect_uri=${REDIRECT_URI}/private`; diff --git a/frontend/frontend/src/pages/App/AppTrends.js b/frontend/frontend/src/pages/App/AppTrends.js index 8bd300e7..5d9b45e5 100644 --- a/frontend/frontend/src/pages/App/AppTrends.js +++ b/frontend/frontend/src/pages/App/AppTrends.js @@ -76,7 +76,7 @@ function App() { return (
- +
diff --git a/frontend/frontend/src/pages/Home/Home.js b/frontend/frontend/src/pages/Home/Home.js index 7110bf1e..615a64e3 100644 --- a/frontend/frontend/src/pages/Home/Home.js +++ b/frontend/frontend/src/pages/Home/Home.js @@ -13,10 +13,12 @@ import { import { authenticate } from '../../api'; import { login as _login } from '../../redux/actions/userActions'; -import { PROD } from '../../constants'; +import { HOST } from '../../constants'; import { CardTypes } from '../../utils'; const HomeScreen = () => { + console.log('new env var:', process.env.VERCEL_RELATED_PROJECTS); + const [isLoading, setIsLoading] = useState(false); const userId = useSelector((state) => state.user.userId); @@ -118,8 +120,7 @@ const HomeScreen = () => { if (url.includes('code=')) { const tempPrivateAccess = url.includes('private'); const newUrl = url.split('?code='); - const subStr = PROD ? 'githubtrends.io' : 'localhost:3000'; - const redirect = `${url.split(subStr)[0]}${subStr}/user`; + const redirect = `${url.split(HOST)[0]}${HOST}/frontend/user`; window.history.pushState({}, null, redirect); setIsLoading(true); const userKey = uuidv4(); diff --git a/frontend/vercel.json b/frontend/vercel.json index d7a899e6..1e10f21e 100644 --- a/frontend/vercel.json +++ b/frontend/vercel.json @@ -1,5 +1,6 @@ { "buildCommand": "yarn build-trends", "outputDirectory": "build", - "installCommand": "yarn install" + "installCommand": "yarn install", + "relatedProjects": ["prj_ubTjOvYDA9zS24cT9hMARICRm9Vm"] } \ No newline at end of file