Test cachingu scenerii

This commit is contained in:
2022-07-14 20:44:43 +02:00
parent 55c64d5f0a
commit d79705ca5c
6 changed files with 123 additions and 59 deletions
+59
View File
@@ -0,0 +1,59 @@
<template>
<section>
<!-- <h2>Ostatnie aktualizacje w Stacjowniku</h2>
<p>Tutaj będą pojawiać się informacje o kolejnych nowościach na stronie :)</p>
<ul>
<li v-for="update in updates">
<div>{{ update.date }}</div>
<div>
<span v-for="(line, l) in update.content" :key="l">{{ line }}</span>
</div>
</li>
</ul> -->
</section>
</template>
<script lang="ts">
import { ReleaseAPIData } from '@/scripts/interfaces/github_api/ReleaseAPIData';
import { defineComponent } from '@vue/runtime-core';
import packageInfo from '../../../package.json';
import axios from 'axios';
const GH_LASTEST_RELEASE_URL = 'https://api.github.com/repos/Spythere/stacjownik/releases/latest';
export default defineComponent({
mounted() {
this.fetchReleases();
},
data() {
return {
cardOpen: false,
updateBody: '',
};
},
methods: {
async fetchReleases() {
try {
const releaseData: ReleaseAPIData = await (await axios.get(GH_LASTEST_RELEASE_URL)).data;
if(!releaseData) return;
const tagVersion = releaseData.tag_name.slice(1);
console.log(packageInfo.version == tagVersion);
this.updateBody = releaseData.body;
} catch (error) {
console.error(`Wystąpił błąd podczas pobierania danych z API GitHuba: ${error}`);
}
},
},
});
</script>
<style lang="scss" scoped></style>
-47
View File
@@ -1,47 +0,0 @@
<template>
<section
class="updates card"
v-if="cardOpen"
>
<h2>Ostatnie aktualizacje w Stacjowniku</h2>
<p>Tutaj będą pojawiać się informacje o kolejnych nowościach na stronie :)</p>
<ul>
<li
v-for="(update, i) in updates"
:key="i"
>
<div>{{update.date}}</div>
<div>
<span
v-for="(line, l) in content"
:key="l"
>{{line}}</span>
</div>
</li>
</ul>
</section>
</template>
<script>
import { defineComponent } from "@vue/runtime-core";
export default defineComponent({
data() {
return {
updates: {
date: "08/08/20",
content: [
"Lekko odświeżono wygląd strony, dodano nowy widok z pociągami online",
"Dodano animacje zmieniania widoków (zakładek)",
"Dodano przycisk zamykający kartę z filtrami",
],
},
};
},
});
</script>
<style lang="scss" scoped>
</style>