mirror of
https://github.com/gotson/komga.git
synced 2026-05-08 12:35:30 +02:00
explicit store typing
This commit is contained in:
parent
3066f1726d
commit
474904edb0
5 changed files with 32 additions and 13 deletions
|
|
@ -553,7 +553,7 @@ function fetchBooks(book: BookImport) {
|
|||
condition: {
|
||||
seriesId: { operator: 'Is', value: book.series!.id },
|
||||
},
|
||||
} as components['schemas']['BookSearch'],
|
||||
},
|
||||
pageRequest: PageRequest.Unpaged(),
|
||||
}),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -492,7 +492,7 @@ const getSeriesBooks = useMemoize(async (seriesId: string) =>
|
|||
condition: {
|
||||
seriesId: { operator: 'Is', value: seriesId },
|
||||
},
|
||||
} as components['schemas']['BookSearch'],
|
||||
},
|
||||
}),
|
||||
)
|
||||
.refresh()
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ function showDialog(action: ACTION, user?: components['schemas']['UserDto']) {
|
|||
age: 0,
|
||||
restriction: 'NONE',
|
||||
},
|
||||
} as components['schemas']['UserCreationDto']
|
||||
}
|
||||
dialogConfirmEdit.value.callback = handleDialogConfirmation
|
||||
break
|
||||
case ACTION.EDIT:
|
||||
|
|
@ -141,7 +141,7 @@ function showDialog(action: ACTION, user?: components['schemas']['UserDto']) {
|
|||
age: 0,
|
||||
restriction: 'NONE',
|
||||
},
|
||||
} as components['schemas']['UserUpdateDto']
|
||||
}
|
||||
dialogConfirmEdit.value.callback = handleDialogConfirmation
|
||||
break
|
||||
case ACTION.DELETE:
|
||||
|
|
|
|||
|
|
@ -5,25 +5,38 @@ import type { PresentationMode } from '@/types/libraries'
|
|||
import type { PageSize, Paging } from '@/types/page'
|
||||
import type { Sort } from '@/types/PageRequest'
|
||||
|
||||
interface AppState {
|
||||
drawer: boolean
|
||||
theme: string
|
||||
rememberMe: boolean
|
||||
importBooksPath: string
|
||||
browsingPageSize: PageSize
|
||||
browsingPaging: Paging
|
||||
presentationMode: Record<string, PresentationMode>
|
||||
sortActive: Record<string, Sort[]>
|
||||
gridCardWidth: number
|
||||
reorderLibraries: boolean
|
||||
}
|
||||
|
||||
export const useAppStore = defineStore('app', {
|
||||
state: () => ({
|
||||
state: (): AppState => ({
|
||||
// persisted
|
||||
drawer: !useDisplay().mobile.value.valueOf(),
|
||||
theme: 'system',
|
||||
rememberMe: false,
|
||||
importBooksPath: '',
|
||||
browsingPageSize: 20 as PageSize,
|
||||
browsingPaging: 'scroll' as Paging,
|
||||
browsingPageSize: 20,
|
||||
browsingPaging: 'scroll',
|
||||
/**
|
||||
* Store the presentation mode per view.
|
||||
* Use the getter to ensure a default value is always set.
|
||||
*/
|
||||
presentationMode: {} as Record<string, PresentationMode>,
|
||||
presentationMode: {},
|
||||
/**
|
||||
* Store the sort order per view.
|
||||
* Use the getter to ensure a default value is always set.
|
||||
*/
|
||||
sortActive: {} as Record<string, Sort[]>,
|
||||
sortActive: {},
|
||||
gridCardWidth: 150,
|
||||
// transient
|
||||
reorderLibraries: false,
|
||||
|
|
|
|||
|
|
@ -2,12 +2,18 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import type { DialogConfirmEditProps, DialogConfirmProps, DialogSimpleProps } from '@/types/dialog'
|
||||
|
||||
interface DialogsState {
|
||||
confirmEdit: DialogConfirmEditActivation
|
||||
confirm: DialogConfirmActivation
|
||||
simple: DialogSimpleActivation
|
||||
}
|
||||
|
||||
/**
|
||||
* Reusable dialogs.
|
||||
* The single instances of the dialogs are created under App, and can be triggered by using this store.
|
||||
*/
|
||||
export const useDialogsStore = defineStore('dialogs', {
|
||||
state: () => ({
|
||||
state: (): DialogsState => ({
|
||||
confirmEdit: {
|
||||
dialogProps: {},
|
||||
slot: {
|
||||
|
|
@ -17,7 +23,7 @@ export const useDialogsStore = defineStore('dialogs', {
|
|||
},
|
||||
record: undefined,
|
||||
callback: () => {},
|
||||
} as DialogConfirmEditActivation,
|
||||
},
|
||||
confirm: {
|
||||
dialogProps: {},
|
||||
slotWarning: {
|
||||
|
|
@ -26,7 +32,7 @@ export const useDialogsStore = defineStore('dialogs', {
|
|||
handlers: {},
|
||||
},
|
||||
callback: () => {},
|
||||
} as DialogConfirmActivation,
|
||||
},
|
||||
simple: {
|
||||
dialogProps: {},
|
||||
slot: {
|
||||
|
|
@ -35,7 +41,7 @@ export const useDialogsStore = defineStore('dialogs', {
|
|||
handlers: {},
|
||||
},
|
||||
callback: () => {},
|
||||
} as DialogSimpleActivation,
|
||||
},
|
||||
}),
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue