Please someone should help me, trying to use redux

how do i use moralis below ...const {login} =useMoralis();


export const login = createAsyncThunk(

    'auth/login',

    async (_, { dispatch }) => {

        let res = await fetch('/auth/login');

        if (res.ok) {

            let data = await res.json();

            if (data.user) {

                dispatch(loggedIn(data.user))

            }

        }

        else if (res.status >= 500) {

            throw Error("Request Error")

        }

        else if (res.status >= 400) {

            dispatch(loggedOut())

        }

        return null;

    }

)
is this correct 

export const login = createAsyncThunk(
    'auth/login',
    async (_, { dispatch }) => {
        let res = await (Moralis as any).login('login');
        if (res.ok) {
            let data = await res.json();
            if (data.user) {
                dispatch(loggedIn(data.user))
            }
        }
        else if (res.status >= 500) {
            throw Error("Request Error")
        }
        else if (res.status >= 400) {
            dispatch(loggedOut())
        }
        return null;
    }
)

what are you trying to do, what is the problem that you have?

i am trying to use redux toolkit with moralis