Skip to content

Commit

Permalink
now works when logged out, yet to test when logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
qiandrewj committed Sep 26, 2024
1 parent 6502c60 commit ef3e1d5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 1 addition & 3 deletions client/src/modules/Course/Components/Course.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,7 @@ export const Course = () => {
})
Session.setPersistent({ review_num: selectedClass?.classNum })
Session.setPersistent({ courseId: selectedClass?._id })

signIn('profile')
}
}

/**
* Clear review stored in session storage
Expand Down
6 changes: 4 additions & 2 deletions client/src/modules/Course/Components/ReviewModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const ReviewModal = ({
const [anonymousOpen, setAnonymousOpen] = useState<boolean>(false)
const [noReviews, setNoReviews] = useState<boolean>(false)

const {isLoggedIn, netId} = useAuthOptionalLogin()
const {isLoggedIn, netId, signIn} = useAuthOptionalLogin()

const [valid, setValid] = useState<Valid>({
professor: false,
Expand Down Expand Up @@ -145,9 +145,11 @@ const ReviewModal = ({

// Handle click of submit button
function onSubmitReview() {
if (!noReviews) {
if (!noReviews && isLoggedIn) {
handleSubmitReview()
signIn('profile')
} else {
handleSubmitReview()
setAnonymousOpen(true)
setOpen(false)
}
Expand Down
10 changes: 10 additions & 0 deletions client/src/modules/Profile/Component/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ const Profile = () => {

clearSessionReview()
if (response.status === 200) {
console.log('toast!')
toast.success(
'Thanks for reviewing! New reviews are updated every 24 hours.'
)
Expand Down Expand Up @@ -184,6 +185,15 @@ const Profile = () => {
return (
<div className={styles.page}>
<Navbar userInput="" />
<ToastContainer
position="top-right"
autoClose={5000}
hideProgressBar={false}
closeOnClick
pauseOnFocusLoss
draggable
pauseOnHover
/>
<div className={styles.container}>
<div className={styles.usersection}>
<UserInfo
Expand Down

0 comments on commit ef3e1d5

Please sign in to comment.