Update api.js
This commit is contained in:
1 parent
d79662b809
commit
01afe089f3
1 file changed
+21
@@ -355,5 +355,26 @@ const API = {
|
||||
});
|
||||
if (data.error) throw new Error(data.error);
|
||||
return data;
|
||||
},
|
||||
|
||||
// ============================================================
|
||||
// 修改密码和邮箱
|
||||
// ============================================================
|
||||
async changePassword(oldPassword, newPassword) {
|
||||
const data = await apiFetch('/users/' + currentUser.id + '/password', {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ oldPassword, newPassword })
|
||||
});
|
||||
if (data.error) throw new Error(data.error);
|
||||
return data;
|
||||
},
|
||||
|
||||
async changeEmail(password, newEmail) {
|
||||
const data = await apiFetch('/users/' + currentUser.id + '/email', {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ password, newEmail })
|
||||
});
|
||||
if (data.error) throw new Error(data.error);
|
||||
return data;
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user