From 55ab996795efdb125437d5728b50d03ac5d2612d Mon Sep 17 00:00:00 2001
From: HampusM <hampus@hampusmat.com>
Date: Wed, 9 Jun 2021 22:06:45 +0200
Subject: Added an about page

---
 packages/client/src/views/Repository.vue | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 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 93c3f82..bbadb16 100644
--- a/packages/client/src/views/Repository.vue
+++ b/packages/client/src/views/Repository.vue
@@ -1,7 +1,9 @@
 <template>
 	<div class="container-fluid px-0 d-flex">
-		<RepositoryHeader :repository="$router.currentRoute._rawValue.params.repo" />
-		<RepositoryNavbar :repository="$router.currentRoute._rawValue.params.repo" :active-page="$router.currentRoute._rawValue.path.split('/')[2]" />
+		<RepositoryHeader :name="name" :description="description" />
+		<RepositoryNavbar
+			:repository="$router.currentRoute._rawValue.params.repo" :active-page="$router.currentRoute._rawValue.path.split('/')[2]"
+			:has-readme="has_readme" />
 		<router-view />
 	</div>
 </template>
@@ -9,12 +11,31 @@
 <script>
 import RepositoryHeader from "@/components/RepositoryHeader";
 import RepositoryNavbar from "@/components/RepositoryNavbar";
+import { ref } from "vue";
 
 export default {
 	name: "Repository",
 	components: {
 		RepositoryHeader,
 		RepositoryNavbar
+	},
+	setup(props) {
+		const name = ref("");
+		const description = ref("");
+		const has_readme = ref(null);
+
+		const fetchProjects = async(repository) => {
+			console.log(repository);
+			const repository_data = await (await fetch(`${window.location.protocol}//${window.location.host}/api/v1/repos/${repository}`)).json();
+			name.value = repository_data.data.name;
+			description.value = repository_data.data.description;
+			has_readme.value = repository_data.data.has_readme;
+		};
+
+		return { name, description, has_readme, fetchProjects };
+	},
+	created() {
+		this.fetchProjects(this.$router.currentRoute._rawValue.params.repo);
 	}
 };
 </script>
-- 
cgit v1.2.3-18-g5258

