aboutsummaryrefslogtreecommitdiff
path: root/packages/client/src/views/Repository.vue
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-07-06 13:07:07 +0200
committerHampusM <hampus@hampusmat.com>2021-07-06 13:07:07 +0200
commit39c38c737114dc7f946b1895b2a4ba27a5546c60 (patch)
tree61344a90155845d08c4811da16e6f90504da2625 /packages/client/src/views/Repository.vue
parent4102adab527ccc4f6d8ac210118dea21177c212d (diff)
Migrated frontend to typescript
Diffstat (limited to 'packages/client/src/views/Repository.vue')
-rw-r--r--packages/client/src/views/Repository.vue27
1 files changed, 14 insertions, 13 deletions
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>