mirror of
https://github.com/UniversityOfHelsinkiCS/ohtuilmo.git
synced 2026-10-12 19:03:41 +03:00
tried quickly to fix constant 401 in tests
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user