diff options
| author | Pitu <[email protected]> | 2019-03-29 00:35:58 +0900 |
|---|---|---|
| committer | Pitu <[email protected]> | 2019-03-29 00:35:58 +0900 |
| commit | ea3e503d13b7be477c064b02b9b2e5a9ef06c9a9 (patch) | |
| tree | 8ffd0bef5e2e210ca28478d18c3876b73cc79784 /src/site/pages/a | |
| parent | Added axios package (diff) | |
| download | host.fuwn.me-ea3e503d13b7be477c064b02b9b2e5a9ef06c9a9.tar.xz host.fuwn.me-ea3e503d13b7be477c064b02b9b2e5a9ef06c9a9.zip | |
Added middleware for pages and switched to $axios
Diffstat (limited to 'src/site/pages/a')
| -rw-r--r-- | src/site/pages/a/_identifier.vue | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/site/pages/a/_identifier.vue b/src/site/pages/a/_identifier.vue index a1f719a..d00ad85 100644 --- a/src/site/pages/a/_identifier.vue +++ b/src/site/pages/a/_identifier.vue @@ -51,19 +51,26 @@ <script> import Grid from '~/components/grid/Grid.vue'; -import Loading from '~/components/loading/CubeShadow.vue'; import axios from 'axios'; export default { - components: { Grid, Loading }, + components: { Grid }, + data() { + return {}; + }, + computed: { + config() { + return this.$store.state.config; + } + }, async asyncData({ app, params, error }) { try { - const res = await axios.get(`${app.store.state.config.baseURL}/album/${params.identifier}`); - const downloadLink = res.data.downloadEnabled ? `${app.store.state.config.baseURL}/album/${params.identifier}/zip` : null; + const data = await axios.get(`${app.store.state.config.baseURL}/album/${params.identifier}`); + const downloadLink = data.downloadEnabled ? `${app.store.state.config.baseURL}/album/${params.identifier}/zip` : null; return { - name: res.data.name, - downloadEnabled: res.data.downloadEnabled, - files: res.data.files, + name: data.name, + downloadEnabled: data.downloadEnabled, + files: data.files, downloadLink }; } catch (err) { @@ -79,14 +86,6 @@ export default { error({ statusCode: 404, message: 'Post not found' }); } }, - data() { - return {}; - }, - computed: { - config() { - return this.$store.state.config; - } - }, metaInfo() { if (this.files) { return { |