feat: add reset email by verification code

Signed-off-by: Kininaru <shiftregister233@outlook.com>
This commit is contained in:
Kininaru
2021-05-12 21:38:31 +08:00
parent 7bea33dabd
commit 400e335e68
7 changed files with 326 additions and 3 deletions

View File

@ -92,3 +92,26 @@ export function setPassword(userOwner, userName, oldPassword, newPassword) {
body: formData
}).then(res => res.json());
}
export function sendCode(dest, type) {
let formData = new FormData();
formData.append("dest", dest);
formData.append("type", type);
return fetch(`${Setting.ServerUrl}/api/send-verification-code`, {
method: "POST",
credentials: "include",
body: formData
}).then(res => res.json());
}
export function resetEmailOrPhone(dest, type, code) {
let formData = new FormData();
formData.append("dest", dest);
formData.append("type", type);
formData.append("code", code);
return fetch(`${Setting.ServerUrl}/api/reset-email-or-phone`, {
method: "POST",
credentials: "include",
body: formData
}).then(res => res.json());
}