@/api/user#getInfoReq JavaScript Examples

The following examples show how to use @/api/user#getInfoReq. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: user.js    From react-admin-template with MIT License 6 votes vote down vote up
A_getUserInfo = (token) => (dispatch) => {
  return new Promise((resolve, reject) => {
    getInfoReq(token)
      .then((response) => {
        const { data } = response
        const { username } = data
        let userInfo = {
          role: 'admin',
          username: username
        }
        dispatch(A_USER_USER_INFO(userInfo))
        resolve(data)
      })
      .catch((error) => {
        reject(error)
      })
  })
}