|
@@ -1,5 +1,5 @@
|
|
|
import { computed, ref } from "vue";
|
|
|
-import { fetchFloderTypes } from "@/api";
|
|
|
+import { fetchFloderTypes, fetchFloders } from "@/api";
|
|
|
|
|
|
import type { FloderTypes, FloderType, Floder } from "@/api";
|
|
|
import { getFloderByType } from "./floder";
|
|
@@ -10,7 +10,9 @@ export const getFloderType = (id: FloderType["filesTypeId"]) =>
|
|
|
floderTypes.value.find((type) => type.filesTypeId === id);
|
|
|
|
|
|
export const initialFloderTypes = async () => {
|
|
|
+ const floders = await fetchFloders();
|
|
|
floderTypes.value = await fetchFloderTypes();
|
|
|
+ console.log(floders,floderTypes.value,898989)
|
|
|
};
|
|
|
|
|
|
export type FloderRoot = {
|
|
@@ -65,6 +67,7 @@ export const getLevelRoot = (floder: Floder, roots = floderRoots.value): FloderR
|
|
|
}
|
|
|
|
|
|
export const getFlatFloders = (root: FloderRoot, floders: FloderRoot['floders'] = []) => {
|
|
|
+ console.log(root, 99999)
|
|
|
floders.push(...root.floders)
|
|
|
if (root.children?.length) {
|
|
|
root.children.forEach(child => getFlatFloders(child, floders))
|