Fixed password settings so that changed passwords actually work and I can actually change the passwords

This commit is contained in:
NPS Agent
2026-05-11 16:23:05 +09:30
parent df2157b6b9
commit 69588de82c
7 changed files with 110 additions and 16 deletions
+17
View File
@@ -92,6 +92,23 @@ class ApiService {
return data;
}
async changePassword(id, oldPassword, newPassword) {
const response = await fetch(`${this.baseUrl}/users/${id}/password`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
...(this.token ? { Authorization: `Bearer ${this.token}` } : {}),
},
body: JSON.stringify({ old_password: oldPassword, new_password: newPassword }),
});
if (!response.ok) {
let detail = response.statusText;
try { const j = await response.json(); if (j.detail) detail = j.detail; } catch {}
throw new Error(detail);
}
return response.json();
}
async getTasks() {
return this.request('/tasks');
}