diff options
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> |