diff options
author | HampusM <hampus@hampusmat.com> | 2021-07-25 22:34:22 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-07-25 22:34:22 +0200 |
commit | 4bbf220296765a20c3ba03c5351b21618a835424 (patch) | |
tree | da6b685a7496bceb928d397f5a073edf1083af44 /packages/client/src/views/RepositoryTree.vue | |
parent | 7d27f9c7f1b57693dfdc0dd289015406b90984ec (diff) |
Reformated the client code a bit
Diffstat (limited to 'packages/client/src/views/RepositoryTree.vue')
-rw-r--r-- | packages/client/src/views/RepositoryTree.vue | 13 |
1 files changed, 7 insertions, 6 deletions
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<string> = ref(""); const path: Ref<string | null> = 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({ <style lang="scss" scoped> @import "~vue-loading-overlay/dist/vue-loading.css"; -</style> +</style>
\ No newline at end of file |