Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 39d74503

Přidáno uživatelem Václav Honzík před téměř 3 roky(ů)

re #9369 - catalog item thunks

Zobrazit rozdíly:

frontend/src/features/Auth/userThunks.ts
1 1
import { createAsyncThunk } from '@reduxjs/toolkit'
2 2
import axiosInstance from '../../api/api'
3
import { UserDto } from '../../swagger/data-contracts'
4
import { setErr, setUserState, UserState } from './userSlice'
3
import {  UserState } from './userSlice'
5 4
import jwt from 'jwt-decode' 
6
import { RootState } from '../redux/store'
7 5

  
8 6
const loginError =
9 7
    'Server error occurred while logging in. Please contact help service to resolve this issue or try again later.'
......
16 14

  
17 15
export const logIn = createAsyncThunk(
18 16
    'user/login',
19
    async (userDto: UserLogin, { dispatch, getState }) => {
17
    async (userDto: UserLogin, { getState }) => {
20 18
        try {
21 19
            // @ts-ignore
22 20
            if (getState().user.isLoggedIn) {
......
47 45
            
48 46
            return userState
49 47
        } catch (err: any) {
50
            console.log(err)
51 48
            return Promise.reject(loginError)
52 49
        }
53 50
    }

Také k dispozici: Unified diff