Update api.js
This commit is contained in:
1 parent
c674847586
commit
4ec329afbc
1 file changed
+26
@@ -329,5 +329,31 @@ const API = {
|
|||||||
});
|
});
|
||||||
if (data.error) throw new Error(data.error);
|
if (data.error) throw new Error(data.error);
|
||||||
return data;
|
return data;
|
||||||
|
},
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 恢复码
|
||||||
|
// ============================================================
|
||||||
|
async generateRecoveryCodes() {
|
||||||
|
const data = await apiFetch('/auth/recovery-codes/generate', {
|
||||||
|
method: 'POST'
|
||||||
|
});
|
||||||
|
if (data.error) throw new Error(data.error);
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
|
||||||
|
async getRecoveryCodesCount() {
|
||||||
|
const data = await apiFetch('/auth/recovery-codes/count');
|
||||||
|
if (data.error) throw new Error(data.error);
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
|
||||||
|
async resetPassword(email, recoveryCode, newPassword) {
|
||||||
|
const data = await apiFetch('/auth/reset-password', {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify({ email, recoveryCode, newPassword })
|
||||||
|
});
|
||||||
|
if (data.error) throw new Error(data.error);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user