From 39c38c737114dc7f946b1895b2a4ba27a5546c60 Mon Sep 17 00:00:00 2001
From: HampusM <hampus@hampusmat.com>
Date: Tue, 6 Jul 2021 13:07:07 +0200
Subject: Migrated frontend to typescript

---
 packages/client/src/views/RepositoryAbout.vue | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

(limited to 'packages/client/src/views/RepositoryAbout.vue')

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>
-- 
cgit v1.2.3-18-g5258

