diff options
author | HampusM <hampus@hampusmat.com> | 2021-07-06 13:07:07 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-07-06 13:07:07 +0200 |
commit | 39c38c737114dc7f946b1895b2a4ba27a5546c60 (patch) | |
tree | 61344a90155845d08c4811da16e6f90504da2625 /packages/client/src/views/RepositoryCommit.vue | |
parent | 4102adab527ccc4f6d8ac210118dea21177c212d (diff) |
Migrated frontend to typescript
Diffstat (limited to 'packages/client/src/views/RepositoryCommit.vue')
-rw-r--r-- | packages/client/src/views/RepositoryCommit.vue | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/packages/client/src/views/RepositoryCommit.vue b/packages/client/src/views/RepositoryCommit.vue index a2caa74..50ec9ad 100644 --- a/packages/client/src/views/RepositoryCommit.vue +++ b/packages/client/src/views/RepositoryCommit.vue @@ -49,16 +49,18 @@ </div> </template> -<script> -import BaseBreadcrumb from "@/components/BaseBreadcrumb"; -import CommitPatch from "@/components/CommitPatch"; -import Loading from "vue-loading-overlay"; -import BaseErrorMessage from "@/components/BaseErrorMessage"; -import { ref } from "vue"; +<script lang="ts"> +import { defineComponent, Ref, ref } from "vue"; import { format } from "date-fns"; -import fetchData from "@/util/fetch"; +import fetchData from "../util/fetch"; + +import BaseBreadcrumb from "../components/BaseBreadcrumb.vue"; +import CommitPatch from "../components/CommitPatch.vue"; +import Loading from "vue-loading-overlay"; +import BaseErrorMessage from "../components/BaseErrorMessage.vue"; +import { getParam } from "../util/util"; -export default { +export default defineComponent({ name: "RepositoryCommit", components: { BaseBreadcrumb, @@ -68,10 +70,10 @@ export default { }, setup() { const commit = ref(null); - const is_loading = ref(true); - const fetch_failed = ref(null); + const is_loading: Ref<boolean> = ref(true); + const fetch_failed: Ref<string> = ref(""); - const fetchCommit = async(repository, commit_id) => { + const fetchCommit = async(repository: string, commit_id: string) => { const commit_data = await fetchData(`repos/${repository}/log/${commit_id}`, fetch_failed, is_loading, "commit"); if(commit_data) { @@ -83,9 +85,9 @@ export default { return { commit, is_loading, fetch_failed, fetchCommit }; }, created() { - this.fetchCommit(this.$router.currentRoute._rawValue.params.repo, this.$router.currentRoute._rawValue.params.commit); + this.fetchCommit(getParam(this.$route.params, "repo"), getParam(this.$route.params, "commit")); } -}; +}); </script> <style lang="scss"> |