aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/components/HomeHeader.vue
blob: f0366a3596478186f2f408f3d1cedc4522982103 (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
<template>
	<div class="row mx-0">
		<div id="header" class="col d-flex mt-3 ms-2">
			<div class="d-inline ms-3">
				<span id="title" class="fs-1">{{ title }}</span>
				<p id="about" class="mb-3 fs-4">
					{{ about }}
				</p>
			</div>
		</div>
	</div>
</template>

<script>
import { watch, reactive, toRefs } from "vue";

export default {
	name: "HomeHeader",
	setup()
	{
		const state = reactive({ title: String, about: String });

		watch(() =>
		{
			fetch(`http://localhost:1337/api/v1/info`)
				.then((res) => res.json())
				.then((data) =>
				{
					state.title = data["data"]["title"],
					state.about = data["data"]["about"]
				});
		});

		return {
			... toRefs(state)
		};
	}
}
</script>