fix: display username in shared chats

This commit is contained in:
Timothy J. Baek
2024-05-18 14:19:48 -07:00
parent 75491b2f87
commit a8b92e5e9d
6 changed files with 64 additions and 5 deletions
+27
View File
@@ -115,6 +115,33 @@ export const getUsers = async (token: string) => {
return res ? res : [];
};
export const getUserById = async (token: string, userId: string) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/users/${userId}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`
}
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.catch((err) => {
console.log(err);
error = err.detail;
return null;
});
if (error) {
throw error;
}
return res;
};
export const deleteUserById = async (token: string, userId: string) => {
let error = null;