dont use [...path] routing since it breaks building statically
This commit is contained in:
@@ -2,20 +2,48 @@ import { defineStore } from 'pinia';
|
||||
import type { DirectoryEntry } from '~/types';
|
||||
import type { Warren } from '~/types/warrens';
|
||||
|
||||
export const useWarrenStore = defineStore<
|
||||
'warrens',
|
||||
{
|
||||
warrens: Record<string, Warren>;
|
||||
}
|
||||
>('warrens', {
|
||||
export const useWarrenStore = defineStore('warrens', {
|
||||
state: () => ({
|
||||
warrens: {},
|
||||
upload: null,
|
||||
warrens: {} as Record<string, Warren>,
|
||||
current: null as { warrenId: string; path: string } | null,
|
||||
}),
|
||||
});
|
||||
actions: {
|
||||
async setCurrentWarren(warrenId: string, path: string) {
|
||||
this.current = {
|
||||
warrenId,
|
||||
path,
|
||||
};
|
||||
await refreshNuxtData('current-directory');
|
||||
},
|
||||
async addToCurrentWarrenPath(path: string) {
|
||||
if (this.current == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
export const useWarrenRoute = () =>
|
||||
computed(() => useRoute().path.split('/warrens/')[1]);
|
||||
if (!this.current.path.endsWith('/')) {
|
||||
this.current.path += '/';
|
||||
}
|
||||
|
||||
this.current.path += path;
|
||||
await refreshNuxtData('current-directory');
|
||||
},
|
||||
async setCurrentWarrenPath(path: string) {
|
||||
if (this.current == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!path.startsWith('/')) {
|
||||
path = '/' + path;
|
||||
}
|
||||
|
||||
this.current.path = path;
|
||||
await refreshNuxtData('current-directory');
|
||||
},
|
||||
clearCurrentWarren() {
|
||||
this.current = null;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const useCreateDirectoryDialog = defineStore('create_directory_dialog', {
|
||||
state: () => ({
|
||||
|
||||
@@ -5,7 +5,7 @@ export const useUploadStore = defineStore<
|
||||
{
|
||||
startIndex: number;
|
||||
files: UploadFile[];
|
||||
path: string | null;
|
||||
destination: { warrenId: string; path: string } | null;
|
||||
progress: {
|
||||
loadedBytes: number;
|
||||
totalBytes: number;
|
||||
@@ -15,7 +15,7 @@ export const useUploadStore = defineStore<
|
||||
state: () => ({
|
||||
startIndex: 0,
|
||||
files: [],
|
||||
path: null,
|
||||
destination: null,
|
||||
progress: null,
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user