feat/enh: user status

This commit is contained in:
Timothy Jaeryang Baek
2025-12-01 13:18:59 -05:00
parent dba86bc980
commit 51621ba91a
10 changed files with 422 additions and 8 deletions
+30
View File
@@ -327,6 +327,36 @@ export const getUserById = async (token: string, userId: string) => {
return res;
};
export const updateUserStatus = async (token: string, formData: object) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/users/user/status/update`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`
},
body: JSON.stringify({
...formData
})
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.catch((err) => {
console.error(err);
error = err.detail;
return null;
});
if (error) {
throw error;
}
return res;
};
export const getUserInfo = async (token: string) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/users/user/info`, {