refactor(web): folders store (#14305)
* refactor(web): folders store * use typescript private
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import { QueryParameter } from '$lib/constants';
|
||||
import { foldersStore } from '$lib/stores/folders.store';
|
||||
import { foldersStore } from '$lib/stores/folders.svelte';
|
||||
import { authenticate } from '$lib/utils/auth';
|
||||
import { getFormatter } from '$lib/utils/i18n';
|
||||
import { getAssetInfoFromParam } from '$lib/utils/navigation';
|
||||
import { buildTree, normalizeTreePath } from '$lib/utils/tree-utils';
|
||||
import { get } from 'svelte/store';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load = (async ({ params, url }) => {
|
||||
@@ -13,18 +12,16 @@ export const load = (async ({ params, url }) => {
|
||||
const $t = await getFormatter();
|
||||
|
||||
await foldersStore.fetchUniquePaths();
|
||||
const { uniquePaths } = get(foldersStore);
|
||||
|
||||
let pathAssets = null;
|
||||
|
||||
const path = url.searchParams.get(QueryParameter.PATH);
|
||||
if (path) {
|
||||
await foldersStore.fetchAssetsByPath(path);
|
||||
const { assets } = get(foldersStore);
|
||||
pathAssets = assets[path] || null;
|
||||
pathAssets = foldersStore.assets[path] || null;
|
||||
}
|
||||
|
||||
let tree = buildTree(uniquePaths || []);
|
||||
let tree = buildTree(foldersStore.uniquePaths);
|
||||
const parts = normalizeTreePath(path || '').split('/');
|
||||
for (const part of parts) {
|
||||
tree = tree?.[part];
|
||||
|
||||
Reference in New Issue
Block a user