Fixed some stuff
This commit is contained in:
parent
48c4f780c1
commit
374b8cd4e2
4 changed files with 10 additions and 5 deletions
|
|
@ -32,7 +32,7 @@ export default function ConversationProvider(props: {
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
let active = true;
|
let active = true;
|
||||||
|
|
||||||
send("get_chats", {})
|
send("get_conversations", {})
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
if (active) {
|
if (active) {
|
||||||
setConversations(data.data.user_ids);
|
setConversations(data.data.user_ids);
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ function AddConversationButton() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => setLoading(true), 500);
|
const timeout = setTimeout(() => setLoading(true), 500);
|
||||||
|
|
||||||
send("add_conversation", {
|
send("add_conversation", {
|
||||||
chat_partner_name: result.data,
|
chat_partner_name: result.data,
|
||||||
|
|
@ -62,7 +62,10 @@ function AddConversationButton() {
|
||||||
toast("error", "Failed to add conversation, check console for details");
|
toast("error", "Failed to add conversation, check console for details");
|
||||||
console.error("Failed to add conversation", error);
|
console.error("Failed to add conversation", error);
|
||||||
})
|
})
|
||||||
.finally(() => setLoading(false));
|
.finally(() => {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
setLoading(false);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ export const socket = {
|
||||||
ping_iota: z.number(),
|
ping_iota: z.number(),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
get_chats: {
|
get_conversations: {
|
||||||
request: z.object({}),
|
request: z.object({}),
|
||||||
response: z.object({
|
response: z.object({
|
||||||
user_ids: z.array(conversation),
|
user_ids: z.array(conversation),
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ const COMMUNICATION_TYPES = [
|
||||||
"change_confirm",
|
"change_confirm",
|
||||||
"confirm_receive",
|
"confirm_receive",
|
||||||
"confirm_read",
|
"confirm_read",
|
||||||
"get_chats",
|
"get_conversations",
|
||||||
"get_states",
|
"get_states",
|
||||||
"add_community",
|
"add_community",
|
||||||
"remove_community",
|
"remove_community",
|
||||||
|
|
@ -343,6 +343,8 @@ registerDataKinds({ array: "container" }, [
|
||||||
"communities",
|
"communities",
|
||||||
"rho_connections",
|
"rho_connections",
|
||||||
"matches",
|
"matches",
|
||||||
|
"get_conversations",
|
||||||
|
"get_communities",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
registerDataKinds({ array: "number" }, [
|
registerDataKinds({ array: "number" }, [
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue