From 4bbf220296765a20c3ba03c5351b21618a835424 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 25 Jul 2021 22:34:22 +0200 Subject: Reformated the client code a bit --- packages/client/src/views/RepositoryTree.vue | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'packages/client/src/views/RepositoryTree.vue') diff --git a/packages/client/src/views/RepositoryTree.vue b/packages/client/src/views/RepositoryTree.vue index 8ffb480..152b6a4 100644 --- a/packages/client/src/views/RepositoryTree.vue +++ b/packages/client/src/views/RepositoryTree.vue @@ -65,23 +65,24 @@ export default defineComponent({ const fetch_failed: Ref = ref(""); const path: Ref = ref(null); - const fetchTree = async(repository: string) => { + async function fetchTree(repository: string) { blob_content.value = null; tree.value = null; path.value = props.pathArr ? props.pathArr.join("/") : null; - const tree_data: Tree = await fetchData(`repos/${repository}/tree${path.value ? "?path=" + path.value : ""}`, fetch_failed, is_loading, "tree"); + const tree_data = await fetchData(`repos/${repository}/tree${path.value ? "?path=" + path.value : ""}`, fetch_failed, is_loading, "tree") as Tree; if(tree_data) { if(tree_data.type === "tree" && tree_data.content instanceof Array) { - let tree_trees = tree_data.content.filter((entry) => entry.type === "tree"); + let tree_trees = tree_data.content.filter(entry => entry.type === "tree"); tree_trees = tree_trees.sort((a, b) => a.name.localeCompare(b.name)); - let tree_blobs = tree_data.content.filter((entry) => entry.type === "blob"); + let tree_blobs = tree_data.content.filter(entry => entry.type === "blob"); tree_blobs = tree_blobs.sort((a, b) => a.name.localeCompare(b.name)); tree.value = tree_trees.concat(tree_blobs); - } else if(typeof tree_data.content === "string") { + } + else if(typeof tree_data.content === "string") { blob_content.value = tree_data.content; } } @@ -104,4 +105,4 @@ export default defineComponent({ + \ No newline at end of file -- cgit v1.2.3-18-g5258