Argument of type ()=> void is not assignable to parameter of type 'AnyAction'

Viewed 630

[enter image *`

emphasized text

`*description here]2

I am getting error Argument of type ()=> void is not assignable to parameter of type 'AnyAction' I searched this issue all over the internet and still not getting success. I tried re-installing react-redux and redux-thunk also I tried adding thunk middleware in redux store but didn't helped me much. I am turning this login.tsx file in login.jsx solves issue but this is just to check . I am new in learning typescript so please HELP me out !!

export const login = (userLogin: IUserLogin) => 
async (dispatch: Dispatch<IAuthType>) => {
  try {
    const res = await PostApi('login', userLogin)

    dispatch({
      type: AUTH,
      payload: {
        token: res.data.access_token,
        user: res.data.user
      }
    })

  } catch (err: any) {
    console.log(err.response.data.msg)
  }
}
import { IUser } from "../../Utils/TypeScripts";

export const AUTH = 'AUTH'

export interface IAuth{
    msg?: string
    access_token?: string
    user?: IUser
}

export interface IAuthType{
    type: typeof AUTH
    payload: IAuth
}

PLEASE let me know if you need any extra info

0 Answers
Related