refactor: ♻️ Make auth store require less null checks

This commit is contained in:
Jesse Wierzbinski 2026-01-09 22:35:46 +01:00
parent 68e23a818a
commit b23ed66401
No known key found for this signature in database
32 changed files with 111 additions and 124 deletions

View file

@ -3,7 +3,7 @@ import * as m from "~~/paraglide/messages.js";
export const useCacheRefresh = () => {
const authStore = useAuthStore();
const { identity } = storeToRefs(authStore);
const { identityOptional } = storeToRefs(authStore);
authStore.client.getInstance().then((res) => {
authStore.updateActiveIdentity({
@ -13,7 +13,7 @@ export const useCacheRefresh = () => {
// Refresh custom emojis and instance data and me on every reload
watch(
identity,
identityOptional,
async (oldIdentity, newIdentity) => {
if (newIdentity && newIdentity.id !== oldIdentity?.id) {
console.info("Refreshing emoji, instance and account cache");