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/Repository.vue | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

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

diff --git a/packages/client/src/views/Repository.vue b/packages/client/src/views/Repository.vue
index 7b31545..c91491c 100644
--- a/packages/client/src/views/Repository.vue
+++ b/packages/client/src/views/Repository.vue
@@ -8,25 +8,26 @@
 	</div>
 </template>
 
-<script>
-import RepositoryHeader from "@/components/RepositoryHeader";
-import RepositoryNavbar from "@/components/RepositoryNavbar";
-import { ref } from "vue";
+<script lang="ts">
+import { defineComponent, Ref, ref } from "vue";
+import { Router } from "vue-router";
 
-export default {
+import RepositoryHeader from "../components/RepositoryHeader.vue";
+import RepositoryNavbar from "../components/RepositoryNavbar.vue";
+import { getParam } from "../util/util";
+
+export default defineComponent({
 	name: "Repository",
 	components: {
 		RepositoryHeader,
 		RepositoryNavbar
 	},
 	setup(props) {
-		const name = ref("");
-		const description = ref("");
-		const has_readme = ref(null);
-
-		const fetchProjects = async(router, path) => {
-			const repository = router.currentRoute._rawValue.params.repo;
+		const name: Ref<string> = ref("");
+		const description: Ref<string> = ref("");
+		const has_readme: Ref<boolean> = ref(false);
 
+		const fetchProjects = async(repository: string, router: Router, path: string) => {
 			const repository_data = await fetch(`${window.location.protocol}//${window.location.host}/api/v1/repos/${repository}`)
 				.catch(() => {
 					if(path.split("/").length === 2) {
@@ -46,7 +47,7 @@ export default {
 		return { name, description, has_readme, fetchProjects };
 	},
 	created() {
-		this.fetchProjects(this.$router, this.$route.path);
+		this.fetchProjects(getParam(this.$route.params, "repo"), this.$router, this.$route.path);
 	}
-};
+});
 </script>
-- 
cgit v1.2.3-18-g5258

