tried quickly to fix constant 401 in tests

This commit is contained in:
Aaro Koivukangas
2025-12-03 21:52:28 +02:00
parent 2de11d0878
commit 56e6b65c8c
2 changed files with 7 additions and 3 deletions
+2 -2
View File
@@ -117,10 +117,10 @@ const App = (props) => {
fetchData()
const loginInterval = setInterval(() => {
const loginInterval = setInterval(async () => {
if (!isCustomerReviewPage) {
try {
loginService.login()
await loginUser()
} catch (err) {
console.log(err)
}
+5 -1
View File
@@ -9,8 +9,12 @@ const updateIsInstructor = (user, isInstructor) => ({
export const loginUser = (userCredentials) => {
return async (dispatch) => {
const { user, token } = await loginService.login(userCredentials)
if (!userCredentials) {
console.warn("Login failed: No credentials given")
return
}
const { user, token } = await loginService.login(userCredentials)
const { isInstructor } = await userService.checkInstructor(token)
dispatch({