diff options
author | HampusM <hampus@hampusmat.com> | 2021-06-09 22:06:45 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-06-09 22:06:45 +0200 |
commit | 55ab996795efdb125437d5728b50d03ac5d2612d (patch) | |
tree | fe0de086fdf7062bed9251173add9609f631949a /packages/client/src/views/RepositoryAbout.vue | |
parent | de09be1b40a9338eb0e45bede01179a69f00269d (diff) |
Added an about page
Diffstat (limited to 'packages/client/src/views/RepositoryAbout.vue')
-rw-r--r-- | packages/client/src/views/RepositoryAbout.vue | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/packages/client/src/views/RepositoryAbout.vue b/packages/client/src/views/RepositoryAbout.vue new file mode 100644 index 0000000..4b4d700 --- /dev/null +++ b/packages/client/src/views/RepositoryAbout.vue @@ -0,0 +1,58 @@ +<template> + <div class="row mx-0"> + <div class="col ms-4 ps-4 ps-sm-5 mt-3 fs-5 vld-parent"> + <RepositoryTreeBlob + :repository="$router.currentRoute._rawValue.params.repo" path="README.md" + :content="readme" v-if="readme" /> + <BaseErrorMessage :fetch-failed="fetch_failed" /> + <Loading + :active="is_loading" :height="24" + :width="24" color="#ffffff" + :opacity="0" :is-full-page="false" /> + </div> + </div> +</template> + +<script> +import RepositoryTreeBlob from "@/components/RepositoryTreeBlob"; +import Loading from "vue-loading-overlay"; +import BaseErrorMessage from "@/components/BaseErrorMessage"; +import { ref } from "vue"; +import fetchData from "@/util/fetch"; + +export default { + name: "RepositoryAbout", + components: { + RepositoryTreeBlob, + Loading, + BaseErrorMessage + }, + setup(props) { + const readme = ref(null); + const is_loading = ref(true); + const fetch_failed = ref(null); + + const fetchReadme = async(repository) => { + const readme_data = await fetchData(`repos/${repository}/tree?path=README.md`, fetch_failed, is_loading, "tree"); + + if(readme_data) { + readme.value = readme_data.content; + } + }; + + return { + readme, + is_loading, + fetch_failed, + fetchReadme + }; + }, + created() { + this.fetchReadme(this.$router.currentRoute._rawValue.params.repo); + } +}; +</script> + +<style lang="scss"> +@import "~vue-loading-overlay/dist/vue-loading.css"; +</style> |