feat/enh: dm from user profile preview

This commit is contained in:
Timothy Jaeryang Baek
2025-11-30 11:04:06 -05:00
parent 3c846617cd
commit a0826ec9fe
4 changed files with 112 additions and 33 deletions
+31
View File
@@ -104,6 +104,37 @@ export const getChannelById = async (token: string = '', channel_id: string) =>
return res;
};
export const getDMChannelByUserId = async (token: string = '', user_id: string) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/channels/users/${user_id}`, {
method: 'GET',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
}
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.then((json) => {
return json;
})
.catch((err) => {
error = err.detail;
console.error(err);
return null;
});
if (error) {
throw error;
}
return res;
};
export const getChannelMembersById = async (
token: string,
channel_id: string,