|
|
@@ -1,20 +1,20 @@
|
|
|
import Taro from '@tarojs/taro'
|
|
|
-import { API_OAUTH_LOGIN, API_REGISTER,API_LOGIN, API_LOGOUT, API_CLEAR_USER, API_USER_INFO,API_CHECK_UNIQUE } from './http/api'
|
|
|
+import { API_OAUTH_LOGIN, API_REGISTER, API_LOGIN, API_LOGOUT, API_CLEAR_USER, API_USER_INFO, API_CHECK_UNIQUE } from './http/api'
|
|
|
import { request } from './http/request'
|
|
|
import { clearSuccess, getInfoSuccess, loginSuccess, logoutSuccess, registerSuccess, updateSuccess } from '@/store/user'
|
|
|
|
|
|
|
|
|
-export const checkUnique = (username?: string,email?:string) => {
|
|
|
+export const checkUnique = (username?: string, email?: string) => {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
request({
|
|
|
- url: API_CHECK_UNIQUE, method: 'GET', data: { username:username,email:email }
|
|
|
+ url: API_CHECK_UNIQUE, method: 'GET', data: { username: username, email: email }
|
|
|
}).then(res => {
|
|
|
resolve(res);
|
|
|
console.log(res);
|
|
|
// dispatch(loginSuccess(res));
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
export const login = (username: string, password: string) => (dispatch: any) => {
|
|
|
@@ -25,7 +25,7 @@ export const login = (username: string, password: string) => (dispatch: any) =>
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-export const wxLogin = (code: string/*, encryptedData: string, iv: string*/) => (dispatch: any)=> {
|
|
|
+export const wxLogin = (code: string/*, encryptedData: string, iv: string*/) => (dispatch: any) => {
|
|
|
request({
|
|
|
url: API_OAUTH_LOGIN, method: 'POST',
|
|
|
data: {
|
|
|
@@ -90,11 +90,14 @@ export const getInfo = () => (dispatch: any) => {
|
|
|
}
|
|
|
|
|
|
|
|
|
-export const update = (params:any) => (dispatch: any) => {
|
|
|
- request({
|
|
|
- url: API_USER_INFO, method: 'POST', data: params
|
|
|
- }).then(res => {
|
|
|
- dispatch(updateSuccess(params));
|
|
|
+export const update = (params: any) => {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ request({
|
|
|
+ url: API_USER_INFO, method: 'POST', data: params
|
|
|
+ }).then(res => {
|
|
|
+ // dispatch(updateSuccess(params));
|
|
|
+ resolve(res)
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
|