You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.0 KiB
39 lines
1.0 KiB
import {changeEmailApi, changePwdApi, sendCodeApi} from "./interface";
|
|
// @ts-ignore
|
|
import {Message} from 'element3/src/components/Message'
|
|
|
|
/**
|
|
* 发送验证码
|
|
* @param userEmail
|
|
*/
|
|
export function sendCode(userEmail: string) {
|
|
return fetch(new Request(sendCodeApi, {method: 'POST', body: JSON.stringify({userEmail})}))
|
|
}
|
|
|
|
/**
|
|
* 更换邮箱
|
|
* @param oldEmail
|
|
* @param newEmail
|
|
* @param code
|
|
*/
|
|
export function changeEmail(oldEmail: string, newEmail: string, code: string) {
|
|
return fetch(new Request(changeEmailApi, {method: 'POST', body: JSON.stringify({oldEmail, newEmail, code})}))
|
|
}
|
|
|
|
/**
|
|
* 更换密码
|
|
* @param userEmail
|
|
* @param password
|
|
*/
|
|
export function changePwd(userEmail: string, password: string) {
|
|
return fetch(new Request(changePwdApi, {method: 'POST', body: JSON.stringify({userEmail, password})}))
|
|
}
|
|
|
|
export function message(res: any) {
|
|
new Message({
|
|
showClose: true,
|
|
duration: 3000,
|
|
message: res.message,
|
|
type: res.result === 'OK' ? 'success' : 'error'
|
|
})
|
|
} |