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 | |
parent | 7d27f9c7f1b57693dfdc0dd289015406b90984ec (diff) |
Reformated the client code a bit
Diffstat (limited to 'packages/client/src/views')
-rw-r--r-- | packages/client/src/views/Home.vue | 6 | ||||
-rw-r--r-- | packages/client/src/views/PageNotFound.vue | 2 | ||||
-rw-r--r-- | packages/client/src/views/Repository.vue | 6 | ||||
-rw-r--r-- | packages/client/src/views/RepositoryAbout.vue | 6 | ||||
-rw-r--r-- | packages/client/src/views/RepositoryCommit.vue | 6 | ||||
-rw-r--r-- | packages/client/src/views/RepositoryLog.vue | 6 | ||||
-rw-r--r-- | packages/client/src/views/RepositoryTree.vue | 13 |
7 files changed, 23 insertions, 22 deletions
diff --git a/packages/client/src/views/Home.vue b/packages/client/src/views/Home.vue index 1edafff..1d4cfa1 100644 --- a/packages/client/src/views/Home.vue +++ b/packages/client/src/views/Home.vue @@ -52,8 +52,8 @@ export default defineComponent({ const is_loading: Ref<boolean> = ref(true); const fetch_failed: Ref<string> = ref(""); - const fetchProjects = async() => { - const projects_data: RepositorySummary[] = await fetchData("repos", fetch_failed, is_loading, "projects"); + async function fetchProjects() { + const projects_data = await fetchData("repos", fetch_failed, is_loading, "projects") as RepositorySummary[]; projects_data.reduce((result: RepositorySummary[], project) => { if(typeof project.last_updated === "number") { @@ -101,4 +101,4 @@ export default defineComponent({ } } -</style> +</style>
\ No newline at end of file diff --git a/packages/client/src/views/PageNotFound.vue b/packages/client/src/views/PageNotFound.vue index f373f42..b8896df 100644 --- a/packages/client/src/views/PageNotFound.vue +++ b/packages/client/src/views/PageNotFound.vue @@ -8,4 +8,4 @@ import { defineComponent } from "vue"; export default defineComponent({ name: "PageNotFound" }); -</script> +</script>
\ No newline at end of file diff --git a/packages/client/src/views/Repository.vue b/packages/client/src/views/Repository.vue index a3a973d..90578fb 100644 --- a/packages/client/src/views/Repository.vue +++ b/packages/client/src/views/Repository.vue @@ -32,7 +32,7 @@ export default defineComponent({ const has_readme: Ref<boolean> = ref(false); const error: Ref<string | null> = ref(null); - const fetchProjects = async(repository: string, router: Router, path: string) => { + async function fetchProjects(repository: string, router: Router, path: string) { const repository_data = await fetch(`${window.location.protocol}//${window.location.host}/api/v1/repos/${repository}`); if(!repository_data.ok) { @@ -45,7 +45,7 @@ export default defineComponent({ if(path.split("/").length === 2) { router.replace(`/${repository}/log`); - }; + } const data: Repository = (await repository_data.json()).data; @@ -60,4 +60,4 @@ export default defineComponent({ this.fetchProjects(getParam(this.$route.params, "repo"), this.$router, this.$route.path); } }); -</script> +</script>
\ No newline at end of file diff --git a/packages/client/src/views/RepositoryAbout.vue b/packages/client/src/views/RepositoryAbout.vue index dc759d1..c72ee12 100644 --- a/packages/client/src/views/RepositoryAbout.vue +++ b/packages/client/src/views/RepositoryAbout.vue @@ -35,8 +35,8 @@ export default defineComponent({ const is_loading: Ref<boolean> = ref(true); const fetch_failed: Ref<string> = ref(""); - const fetchReadme = async(repository: string) => { - const readme_data: Tree = await fetchData(`repos/${repository}/tree?path=README.md`, fetch_failed, is_loading, "tree"); + async function fetchReadme(repository: string) { + const readme_data = await fetchData(`repos/${repository}/tree?path=README.md`, fetch_failed, is_loading, "tree") as Tree; if(readme_data && typeof readme_data.content === "string") { readme.value = readme_data.content; @@ -58,4 +58,4 @@ export default defineComponent({ <style lang="scss" scoped> @import "~vue-loading-overlay/dist/vue-loading.css"; -</style> +</style>
\ No newline at end of file diff --git a/packages/client/src/views/RepositoryCommit.vue b/packages/client/src/views/RepositoryCommit.vue index f0dec4a..9818dff 100644 --- a/packages/client/src/views/RepositoryCommit.vue +++ b/packages/client/src/views/RepositoryCommit.vue @@ -78,8 +78,8 @@ export default defineComponent({ const is_loading: Ref<boolean> = ref(true); const fetch_failed: Ref<string> = ref(""); - const fetchCommit = async(repository: string, commit_id: string) => { - const commit_data: Commit = await fetchData(`repos/${repository}/log/${commit_id}`, fetch_failed, is_loading, "commit"); + async function fetchCommit(repository: string, commit_id: string) { + const commit_data = await fetchData(`repos/${repository}/log/${commit_id}`, fetch_failed, is_loading, "commit") as Commit; if(commit_data) { const pretty_commit = commit_data as PrettyDateCommit; @@ -221,4 +221,4 @@ code { height: 100%; } -</style> +</style>
\ No newline at end of file diff --git a/packages/client/src/views/RepositoryLog.vue b/packages/client/src/views/RepositoryLog.vue index c5ce241..83184fa 100644 --- a/packages/client/src/views/RepositoryLog.vue +++ b/packages/client/src/views/RepositoryLog.vue @@ -74,8 +74,8 @@ export default defineComponent({ const is_loading: Ref<boolean> = ref(true); const fetch_failed: Ref<string> = ref(""); - const fetchLog = async(repository: string) => { - const log_data: LogCommit[] = await fetchData(`repos/${repository}/log`, fetch_failed, is_loading, "log"); + async function fetchLog(repository: string) { + const log_data = await fetchData(`repos/${repository}/log`, fetch_failed, is_loading, "log") as LogCommit[]; if(log_data) { commits.value = log_data; } @@ -147,4 +147,4 @@ table { } } -</style> +</style>
\ No newline at end of file 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 |