mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 09:42:09 -04:00
fix(files): forward arguments to store creation
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
This commit is contained in:
parent
fb0fe5c01c
commit
6527fec10c
7 changed files with 21 additions and 21 deletions
|
|
@ -25,11 +25,11 @@ import type { FilesStore, RootsStore, RootOptions, Service, FilesState } from '.
|
|||
|
||||
import { defineStore } from 'pinia'
|
||||
import { subscribe } from '@nextcloud/event-bus'
|
||||
import Vue from 'vue'
|
||||
import logger from '../logger'
|
||||
import { FileId } from '../types'
|
||||
import type { FileId } from '../types'
|
||||
import Vue from 'vue'
|
||||
|
||||
export const useFilesStore = () => {
|
||||
export const useFilesStore = function() {
|
||||
const store = defineStore('files', {
|
||||
state: (): FilesState => ({
|
||||
files: {} as FilesStore,
|
||||
|
|
@ -88,7 +88,7 @@ export const useFilesStore = () => {
|
|||
}
|
||||
})
|
||||
|
||||
const fileStore = store()
|
||||
const fileStore = store(...arguments)
|
||||
// Make sure we only register the listeners once
|
||||
if (!fileStore._initialized) {
|
||||
// subscribe('files:node:created', fileStore.onCreatedNode)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import Vue from 'vue'
|
|||
* special keys states. Useful for checking the
|
||||
* current status of a key when executing a method.
|
||||
*/
|
||||
export const useKeyboardStore = () => {
|
||||
export const useKeyboardStore = function() {
|
||||
const store = defineStore('keyboard', {
|
||||
state: () => ({
|
||||
altKey: false,
|
||||
|
|
@ -50,7 +50,7 @@ export const useKeyboardStore = () => {
|
|||
}
|
||||
})
|
||||
|
||||
const keyboardStore = store()
|
||||
const keyboardStore = store(...arguments)
|
||||
// Make sure we only register the listeners once
|
||||
if (!keyboardStore._initialized) {
|
||||
window.addEventListener('keydown', keyboardStore.onEvent)
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@
|
|||
import type { PathOptions, ServicesState } from '../types.ts'
|
||||
|
||||
import { defineStore } from 'pinia'
|
||||
import Vue from 'vue'
|
||||
import { subscribe } from '@nextcloud/event-bus'
|
||||
import { FileId } from '../types'
|
||||
import type { FileId } from '../types'
|
||||
import Vue from 'vue'
|
||||
|
||||
export const usePathsStore = () => {
|
||||
export const usePathsStore = function() {
|
||||
const store = defineStore('paths', {
|
||||
state: (): ServicesState => ({}),
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ export const usePathsStore = () => {
|
|||
}
|
||||
})
|
||||
|
||||
const pathsStore = store()
|
||||
const pathsStore = store(...arguments)
|
||||
// Make sure we only register the listeners once
|
||||
if (!pathsStore._initialized) {
|
||||
// TODO: watch folders to update paths?
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ const userConfig = loadState('files', 'config', {
|
|||
crop_image_previews: true,
|
||||
}) as UserConfig
|
||||
|
||||
export const useUserConfigStore = () => {
|
||||
export const useUserConfigStore = function() {
|
||||
const store = defineStore('userconfig', {
|
||||
state: () => ({
|
||||
userConfig,
|
||||
|
|
@ -60,7 +60,7 @@ export const useUserConfigStore = () => {
|
|||
}
|
||||
})
|
||||
|
||||
const userConfigStore = store()
|
||||
const userConfigStore = store(...arguments)
|
||||
|
||||
// Make sure we only register the listeners once
|
||||
if (!userConfigStore._initialized) {
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@ import { loadState } from '@nextcloud/initial-state'
|
|||
import axios from '@nextcloud/axios'
|
||||
import Vue from 'vue'
|
||||
|
||||
import { ViewConfigs, ViewConfigStore, ViewId } from '../types.ts'
|
||||
import { ViewConfig } from '../types'
|
||||
import type { ViewConfigs, ViewConfigStore, ViewId } from '../types'
|
||||
import type { ViewConfig } from '../types'
|
||||
|
||||
const viewConfig = loadState('files', 'viewConfigs', {}) as ViewConfigs
|
||||
|
||||
export const useViewConfigStore = () => {
|
||||
export const useViewConfigStore = function() {
|
||||
const store = defineStore('viewconfig', {
|
||||
state: () => ({
|
||||
viewConfig,
|
||||
|
|
@ -46,7 +46,7 @@ export const useViewConfigStore = () => {
|
|||
/**
|
||||
* Update the view config local store
|
||||
*/
|
||||
onUpdate(view: ViewId, key: string, value: boolean) {
|
||||
onUpdate(view: ViewId, key: string, value: string | number | boolean) {
|
||||
if (!this.viewConfig[view]) {
|
||||
Vue.set(this.viewConfig, view, {})
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ export const useViewConfigStore = () => {
|
|||
/**
|
||||
* Update the view config local store AND on server side
|
||||
*/
|
||||
async update(view: ViewId, key: string, value: boolean) {
|
||||
async update(view: ViewId, key: string, value: string | number | boolean) {
|
||||
axios.put(generateUrl(`/apps/files/api/v1/views/${view}/${key}`), {
|
||||
value,
|
||||
})
|
||||
|
|
@ -88,7 +88,7 @@ export const useViewConfigStore = () => {
|
|||
}
|
||||
})
|
||||
|
||||
const viewConfigStore = store()
|
||||
const viewConfigStore = store(...arguments)
|
||||
|
||||
// Make sure we only register the listeners once
|
||||
if (!viewConfigStore._initialized) {
|
||||
|
|
|
|||
4
dist/files-main.js
vendored
4
dist/files-main.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-main.js.map
vendored
2
dist/files-main.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue