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/RepositoryAbout.vue | |
parent | 4102adab527ccc4f6d8ac210118dea21177c212d (diff) |
Migrated frontend to typescript
Diffstat (limited to 'packages/client/src/views/RepositoryAbout.vue')
-rw-r--r-- | packages/client/src/views/RepositoryAbout.vue | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/packages/client/src/views/RepositoryAbout.vue b/packages/client/src/views/RepositoryAbout.vue index 18855fe..ff96f53 100644 --- a/packages/client/src/views/RepositoryAbout.vue +++ b/packages/client/src/views/RepositoryAbout.vue @@ -13,14 +13,16 @@ </div> </template> -<script> -import RepositoryTreeBlob from "@/components/RepositoryTreeBlob"; +<script lang="ts"> +import { defineComponent, Ref, ref } from "vue"; +import fetchData from "../util/fetch"; + +import RepositoryTreeBlob from "../components/RepositoryTreeBlob.vue"; import Loading from "vue-loading-overlay"; -import BaseErrorMessage from "@/components/BaseErrorMessage"; -import { ref } from "vue"; -import fetchData from "@/util/fetch"; +import BaseErrorMessage from "../components/BaseErrorMessage.vue"; +import { getParam } from "../util/util"; -export default { +export default defineComponent({ name: "RepositoryAbout", components: { RepositoryTreeBlob, @@ -28,11 +30,11 @@ export default { BaseErrorMessage }, setup(props) { - const readme = ref(null); - const is_loading = ref(true); - const fetch_failed = ref(null); + const readme: Ref<string | null> = ref(null); + const is_loading: Ref<boolean> = ref(true); + const fetch_failed: Ref<string> = ref(""); - const fetchReadme = async(repository) => { + const fetchReadme = async(repository: string) => { const readme_data = await fetchData(`repos/${repository}/tree?path=README.md`, fetch_failed, is_loading, "tree"); if(readme_data) { @@ -48,9 +50,9 @@ export default { }; }, created() { - this.fetchReadme(this.$router.currentRoute._rawValue.params.repo); + this.fetchReadme(getParam(this.$route.params, "repo")); } -}; +}); </script> <style lang="scss" scoped> |