Skip to content

Commit

Permalink
fix: pinia persisted store changes
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Trost <[email protected]>
  • Loading branch information
galexrt committed Sep 12, 2024
1 parent 7ae0bb3 commit 82ceb3e
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 33 deletions.
2 changes: 1 addition & 1 deletion app/store/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const useAuthStore = defineStore('auth', {
} as JobProps,
}) as AuthState,
persist: {
paths: ['accessTokenExpiration', 'lastCharID', 'username'],
pick: ['accessTokenExpiration', 'lastCharID', 'username'],
},
actions: {
loginStart(): void {
Expand Down
6 changes: 2 additions & 4 deletions app/store/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ export const useCalendarStore = defineStore('calendar', {
entries: [],
}) as CalendarState,
persist: {
key(id) {
return `state-${useAuthStore().activeChar?.userId}-${id}`;
},
paths: ['activeCalendarIds', 'weeklyView'],
key: (id: string) => `state-${useAuthStore().activeChar?.userId}-${id}`,
pick: ['activeCalendarIds', 'weeklyView'],
},
actions: {
// Calendars
Expand Down
2 changes: 1 addition & 1 deletion app/store/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const useSettingsStore = defineStore('settings', {
featureGates: {},
}) as SettingsState,
persist: {
paths: [
pick: [
'version',
'locale',
'nuiEnabled',
Expand Down
4 changes: 3 additions & 1 deletion app/utils/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,7 @@ export function checkAccess<L = number>(
}
}

return (lowestAccess ?? 0) >= level;
console.log('level', level, 'lowestAccess', lowestAccess, activeChar.firstname, activeChar.jobGrade);

return level <= (lowestAccess ?? 0);
}
3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@

devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
# Workaround CGO issue https://nixos.wiki/wiki/Go#Using_cgo_on_NixOS
hardeningDisable = [ "fortify" ];

packages = with pkgs; [
# go (version is specified by overlay)
go
Expand Down
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default defineNuxtConfig({
'@nuxtjs/fontaine',
'@vueuse/nuxt',
'@pinia/nuxt',
'@pinia-plugin-persistedstate/nuxt',
'pinia-plugin-persistedstate/nuxt',
'nuxt-zod-i18n',
'@nuxtjs/i18n',
'@galexrt/nuxt-update',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@nuxt/eslint-config": "0.5.7",
"@nuxtjs/fontaine": "0.4.3",
"@nuxtjs/i18n": "8.5.3",
"@pinia-plugin-persistedstate/nuxt": "1.2.1",
"pinia-plugin-persistedstate": "4.0.1",
"@protobuf-ts/plugin": "2.9.4",
"@total-typescript/ts-reset": "0.6.1",
"@types/google-protobuf": "3.15.12",
Expand Down
30 changes: 6 additions & 24 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 82ceb3e

Please sign in to comment.