Skip to content

Commit

Permalink
Refactor main store: improve localStorage handling and author and blu…
Browse files Browse the repository at this point in the history
…r toggle
  • Loading branch information
vitormarcal committed Dec 21, 2024
1 parent 36cc506 commit bad1645
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions frontend/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@ export const useMainStore = defineStore('main', () => {
messages: [] as ChatMessage[],
attachmentsInfo: [] as any[],
chatActive: {} as Chat,
authorActive: '',
authorActive: localStorage.getItem("authorActive") || '',
chatConfigOpen: false,
nextPage: 0,
pageSize: 20,
pageSize: localStorage.getItem("pageSize") || 20,
searchQuery: undefined,
reloadImageProfile: false,
blurEnabled: true,
blurEnabled: localStorage.getItem("blurEnabled") === 'true',
});

watch(() => state.authorActive, (newValue) => {
localStorage.setItem("authorActive", newValue || '');
});

watch(() => state.blurEnabled, (newValue) => {
localStorage.setItem("blurEnabled", newValue.toString());
});

const authors = computed(() => {
Expand Down

0 comments on commit bad1645

Please sign in to comment.