blob: 39ec00d73438ec209b1e8f1ed7b2967b10442692 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<template>
<div class="row mx-0">
<div id="header" class="col d-flex mt-3 ms-2">
<BaseBackButton to="/" />
<div class="d-inline ms-3">
<span id="title" class="fs-1">{{ title }}</span>
<p id="about" class="fs-4">
{{ about }}
</p>
</div>
</div>
</div>
</template>
<script>
import BaseBackButton from "./BaseBackButton";
import { watch, reactive, toRefs } from "vue";
export default {
name: "RepositoryHeader",
components: {
BaseBackButton
},
props: {
repository: {
type: String,
required: true
}
},
setup(props)
{
const state = reactive({ title: "", about: "" });
watch(() =>
{
fetch(`${window.location.protocol}//${window.location.host}/api/v1/repos/${props.repository}`)
.then((res) => res.json())
.then((data) =>
{
state.title = data["data"]["name"];
state.about = data["data"]["description"];
});
});
return {
... toRefs(state)
};
}
};
</script>
|