diff --git a/bun.lockb b/bun.lockb index ac63b83..26f9be6 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/components/composer/composer.vue b/components/composer/composer.vue index 9a356aa..ce4b90b 100644 --- a/components/composer/composer.vue +++ b/components/composer/composer.vue @@ -32,10 +32,6 @@ const props = defineProps<{ instance: Instance; }>(); -const emits = defineEmits<{ - send: []; -}>(); - const submitting = ref(false); const tokenData = useTokenData(); const client = useMegalodon(tokenData); @@ -43,29 +39,29 @@ const client = useMegalodon(tokenData); const send = async () => { submitting.value = true; - await fetch( - new URL("/api/v1/statuses", client.value?.baseUrl ?? "").toString(), - { - method: "POST", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${tokenData.value?.access_token}`, - }, - body: JSON.stringify({ - status: content.value, - content_type: "text/markdown", - }), + fetch(new URL("/api/v1/statuses", client.value?.baseUrl ?? "").toString(), { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${tokenData.value?.access_token}`, }, - ).then((res) => { - if (!res.ok) { - throw new Error("Failed to send status"); - } + body: JSON.stringify({ + status: content.value, + content_type: "text/markdown", + }), + }) + .then(async (res) => { + if (!res.ok) { + throw new Error("Failed to send status"); + } - content.value = ""; - submitting.value = false; - }); - - emits("send"); + content.value = ""; + submitting.value = false; + useEvent("composer:send", await res.json()); + }) + .finally(() => { + useEvent("composer:close"); + }); }; const characterLimit = computed( diff --git a/components/composer/modal.vue b/components/composer/modal.vue index 0f52262..61008d9 100644 --- a/components/composer/modal.vue +++ b/components/composer/modal.vue @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/components/sidebars/navigation.vue b/components/sidebars/navigation.vue index cce384f..453bf5e 100644 --- a/components/sidebars/navigation.vue +++ b/components/sidebars/navigation.vue @@ -47,7 +47,6 @@ -