Skip to content

Commit

Permalink
Merge pull request #274 from SELab-2/feature/no-msal-react
Browse files Browse the repository at this point in the history
edit hard coded urls
  • Loading branch information
Matthias-VE authored May 20, 2024
2 parents 65a81e0 + 2e57e2e commit 1801b0d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion frontend/src/components/layout/nav/AuthNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import useAuth from "../../../hooks/useAuth"

import createCourseModal from "../../../pages/index/components/CreateCourseModal"
import useIsTeacher from "../../../hooks/useIsTeacher"
import {BACKEND_SERVER} from "../../../util/backendServer";


const AuthNav = () => {
Expand Down Expand Up @@ -66,7 +67,7 @@ const AuthNav = () => {
break
case "logout":
auth.logout()
window.location.replace("http://localhost:3000/web/auth/signout")
window.location.replace(BACKEND_SERVER + "/web/auth/signout")
break
case Themes.DARK:
case Themes.LIGHT:
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/layout/nav/UnauthNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useTranslation } from "react-i18next";
import { Button } from "antd";
import useAuth from "../../../hooks/useAuth";
import {useNavigate} from "react-router-dom";
import {BACKEND_SERVER} from "../../../util/backendServer";

const UnauthNav = () => {
const { t } = useTranslation();
Expand All @@ -10,7 +11,7 @@ const UnauthNav = () => {
const handleLogin = async () => {
try {
await auth.login()
window.location.replace("http://localhost:3000/web/auth/signin")
window.location.replace(BACKEND_SERVER + "/web/auth/signin")
} catch (error) {
console.error(error)
}
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/pages/index/landing/LandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { useTranslation } from "react-i18next"
import { motion } from "framer-motion"
import useAuth from "../../../hooks/useAuth";
import {useNavigate} from "react-router-dom";
import {BACKEND_SERVER} from "../../../util/backendServer";

const defaultTransition = { duration: 0.5, ease: [0.44, 0, 0.56, 1], type: "tween" }

Expand All @@ -27,7 +28,7 @@ const LandingPage: FC = () => {
const handleLogin = async () => {
try {
await auth.login()
window.location.replace("http://localhost:3000/web/auth/signin")
window.location.replace(BACKEND_SERVER + "/web/auth/signin")
} catch (error) {
console.error(error)
}
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/util/backendServer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

export const BACKEND_SERVER = window.location.origin.includes("localhost") ? "http://localhost:3000" : window.location.origin

0 comments on commit 1801b0d

Please sign in to comment.