update notification handling and improve sorting logic in NotificationTemplate component

This commit is contained in:
Mo Tarbin
2025-06-22 17:21:22 -04:00
parent 97fb8d8561
commit 5b83bf35d0
8 changed files with 316 additions and 263 deletions

View File

@@ -22,8 +22,8 @@ import { GOOGLE_CLIENT_ID, REDIRECT_URL } from '../../Config'
import Logo from '../../Logo'
import { useResource } from '../../queries/ResourceQueries'
import { useNotification } from '../../service/NotificationProvider'
import { login } from '../../utils/Fetcher'
import { apiManager } from '../../utils/TokenManager'
import { GetUserProfile, login } from '../../utils/Fetcher'
import { apiManager, isTokenValid } from '../../utils/TokenManager'
import MFAVerificationModal from './MFAVerificationModal'
const LoginView = () => {
@@ -49,7 +49,19 @@ const LoginView = () => {
}
initializeSocialLogin()
}, [])
useEffect(() => {
if (isTokenValid()) {
GetUserProfile().then(response => {
if (response.status === 200) {
return response.json().then(data => {
setUserProfile(data.res)
})
} else {
console.log('Failed to fetch user profile')
}
})
}
}, [])
const handleSubmit = async e => {
e.preventDefault()
login(username, password)