diff options
-rw-r--r-- | components/PostList/PostList.vue | 15 | ||||
-rw-r--r-- | pages/do-pobrania.vue | 29 | ||||
-rw-r--r-- | pages/kronika/index.vue | 1 | ||||
-rwxr-xr-x | scripts/generateApi.js | 5 | ||||
-rwxr-xr-x | scripts/postbuild.sh | 1 | ||||
-rw-r--r-- | static/files/Książeczka_sprawności.pdf | bin | 0 -> 6080091 bytes |
6 files changed, 44 insertions, 7 deletions
diff --git a/components/PostList/PostList.vue b/components/PostList/PostList.vue index 206a73f..2d1bb2d 100644 --- a/components/PostList/PostList.vue +++ b/components/PostList/PostList.vue @@ -1,8 +1,9 @@ <template> - <pure-post-list :posts="posts" :loading="loading" /> + <pure-post-list v-if="rawPosts" :posts="posts" :loading="loading" /> </template> <script> +import k from '~/api' import PurePostList from './PurePostList' export default { @@ -14,6 +15,12 @@ export default { required: false } }, + async asyncData() { + return { + loading: process.client, + rawPosts: process.client ? undefined : k.getPosts() + } + }, data() { return { loading: true, @@ -21,7 +28,9 @@ export default { } }, mounted() { - this.loadPostsClient() + if (process.client && this.rawPosts === undefined) { + this.loadPostsClient() + } }, computed: { posts() { @@ -46,4 +55,4 @@ export default { } } } -</script> \ No newline at end of file +</script> diff --git a/pages/do-pobrania.vue b/pages/do-pobrania.vue index dd6b507..453b8d4 100644 --- a/pages/do-pobrania.vue +++ b/pages/do-pobrania.vue @@ -1,11 +1,34 @@ <template> <div class="container"> <h1>Do pobrania</h1> - <a class="link" href="/files/Karta_próby_na_sprawność.pdf">Karta próby na sprawność</a> - <a class="link" href="/files/Próba_Harcerza.pdf">Próba Harcerza</a> + <a + v-for="{ file, title } in files" + :key="file" + class="link" + :href="`/files/${file}`" + > + {{ title }} + </a> </div> </template> +<script> +export default { + data() { + return { + files: [ + { + file: 'Karta_próby_na_sprawność.pdf', + title: 'Karta próby na sprawność' + }, + { file: 'Próba_Harcerza.pdf', title: 'Próba Harcerza' }, + { file: 'Książeczka_sprawności.pdf', title: 'Książeczka sprawności' } + ] + } + } +} +</script> + <style scoped> .container { display: flex; @@ -15,4 +38,4 @@ .link { margin: 5px; } -</style> \ No newline at end of file +</style> diff --git a/pages/kronika/index.vue b/pages/kronika/index.vue index d9685c1..b478a75 100644 --- a/pages/kronika/index.vue +++ b/pages/kronika/index.vue @@ -14,4 +14,3 @@ export default { } } </script> - diff --git a/scripts/generateApi.js b/scripts/generateApi.js index f72745e..7635f02 100755 --- a/scripts/generateApi.js +++ b/scripts/generateApi.js @@ -20,4 +20,9 @@ posts.sort((a, b) => (a.route > b.route ? 1 : -1)) fs.writeFile('./dist/api/posts.json', JSON.stringify(posts), err => err ? console.log(err) : null ) + +fs.writeFile('./static/api/posts.json', JSON.stringify(posts), err => + err ? console.log(err) : null +) + console.log(posts) diff --git a/scripts/postbuild.sh b/scripts/postbuild.sh index 85e35f9..6da3659 100755 --- a/scripts/postbuild.sh +++ b/scripts/postbuild.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash mkdir ./dist/api +mkdir ./static/api node -r esm ./scripts/generateApi.js diff --git a/static/files/Książeczka_sprawności.pdf b/static/files/Książeczka_sprawności.pdf new file mode 100644 index 0000000..4768c67 --- /dev/null +++ b/static/files/Książeczka_sprawności.pdf Binary files differ |