mirror of
https://github.com/versia-pub/frontend.git
synced 2025-12-06 08:28:20 +01:00
fix: 🐛 Fixes with not refreshing localStorage me value
This commit is contained in:
parent
14a37d3585
commit
32c13d4c99
12
app.vue
12
app.vue
|
|
@ -22,6 +22,7 @@ const client = useMegalodon(tokenData);
|
|||
const instance = useInstance(client);
|
||||
const description = useExtendedDescription(client);
|
||||
const me = useMe();
|
||||
const customEmojis = useCustomEmojis(client);
|
||||
|
||||
useSeoMeta({
|
||||
titleTemplate: (titleChunk) => {
|
||||
|
|
@ -82,6 +83,17 @@ watch(
|
|||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
// Refresh custom emojis and instance data and me on every reload
|
||||
if (tokenData.value) {
|
||||
await client.value?.verifyAccountCredentials().then((res) => {
|
||||
me.value = res.data;
|
||||
});
|
||||
}
|
||||
|
||||
client.value?.getInstanceCustomEmojis().then((res) => {
|
||||
customEmojis.value = res.data;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<!-- Content warning textbox -->
|
||||
<div v-if="cw !== null" class="mb-4">
|
||||
<div v-if="cw" class="mb-4">
|
||||
<input type="text" v-model="cwContent" placeholder="Add a content warning"
|
||||
class="w-full p-2 mt-1 text-sm prose prose-invert bg-dark-900 rounded focus:!ring-0 !ring-none !border-none !outline-none placeholder:text-zinc-500 appearance-none focus:!border-none focus:!outline-none" />
|
||||
</div>
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
<ComposerButton title="Add a file">
|
||||
<iconify-icon width="1.25rem" height="1.25rem" icon="tabler:file-upload" aria-hidden="true" />
|
||||
</ComposerButton>
|
||||
<ComposerButton title="Add content warning" @click="cw = cw === null ? '' : null" :toggled="cw !== null">
|
||||
<ComposerButton title="Add content warning" @click="cw = !cw" :toggled="cw">
|
||||
<iconify-icon width="1.25rem" height="1.25rem" icon="tabler:rating-18-plus" aria-hidden="true" />
|
||||
</ComposerButton>
|
||||
<ButtonsPrimary :loading="submitting" @click="send" class="ml-auto rounded-full">
|
||||
|
|
@ -68,7 +68,7 @@ const { Control_Enter, Command_Enter, Control_Alt } = useMagicKeys();
|
|||
const respondingTo = ref<Status | null>(null);
|
||||
const respondingType = ref<"reply" | "quote" | null>(null);
|
||||
const me = useMe();
|
||||
const cw = ref(null as string | null);
|
||||
const cw = ref(false);
|
||||
const cwContent = ref("");
|
||||
const markdown = ref(true);
|
||||
|
||||
|
|
@ -130,8 +130,8 @@ const send = async () => {
|
|||
respondingType.value === "quote"
|
||||
? respondingTo.value?.id
|
||||
: null,
|
||||
spoiler_text: cw ? cwContent.value.trim() : undefined,
|
||||
sensitive: !!cw,
|
||||
spoiler_text: cw.value ? cwContent.value.trim() : undefined,
|
||||
sensitive: cw.value,
|
||||
}),
|
||||
})
|
||||
.then(async (res) => {
|
||||
|
|
|
|||
7
composables/CustomEmojis.ts
Normal file
7
composables/CustomEmojis.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import type { Mastodon } from "megalodon";
|
||||
import type { Emoji } from "~/types/mastodon/emoji";
|
||||
|
||||
export const useCustomEmojis = (client: MaybeRef<Mastodon | null>) => {
|
||||
// Cache in localStorage
|
||||
return useLocalStorage<Emoji[]>("lysand:custom_emojis", []);
|
||||
};
|
||||
|
|
@ -100,8 +100,7 @@ const redirect_uri = query.redirect_uri as string;
|
|||
const client_id = query.client_id;
|
||||
const scope = query.scope ? decodeURIComponent(query.scope as string) : "";
|
||||
|
||||
const validUrlParameters =
|
||||
application && redirect_uri && client_id && scope;
|
||||
const validUrlParameters = application && redirect_uri && client_id && scope;
|
||||
|
||||
const oauthScopeText: Record<string, string> = {
|
||||
"rw:accounts": "$VERB your account information",
|
||||
|
|
|
|||
Loading…
Reference in a new issue