chore: switch to asyncData where needed
This commit is contained in:
parent
91a15f417e
commit
a3bf693d30
|
@ -25,7 +25,7 @@ class albumGET extends Route {
|
|||
.select('files.name', 'files.id')
|
||||
.orderBy('files.id', 'desc');
|
||||
|
||||
const { page, limit = 100 } = req.query;
|
||||
const { page, limit = 50 } = req.query;
|
||||
if (page && page >= 0) {
|
||||
files = await files.offset((page - 1) * limit).limit(limit);
|
||||
|
||||
|
|
|
@ -104,9 +104,7 @@ export default {
|
|||
components: {
|
||||
Sidebar
|
||||
},
|
||||
middleware: ['auth', ({ store }) => {
|
||||
store.dispatch('auth/fetchCurrentUser');
|
||||
}],
|
||||
middleware: ['auth'],
|
||||
data() {
|
||||
return {
|
||||
password: '',
|
||||
|
@ -120,6 +118,9 @@ export default {
|
|||
user: state => state.auth.user
|
||||
})
|
||||
},
|
||||
async asyncData({ app }) {
|
||||
await app.store.dispatch('auth/fetchCurrentUser');
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
getUserSetttings: 'auth/fetchCurrentUser'
|
||||
|
|
|
@ -129,15 +129,11 @@ export default {
|
|||
components: {
|
||||
Sidebar
|
||||
},
|
||||
middleware: ['auth', 'admin', ({ route, store }) => {
|
||||
try {
|
||||
store.dispatch('admin/fetchFile', route.params.id);
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(e);
|
||||
}
|
||||
}],
|
||||
middleware: ['auth', 'admin'],
|
||||
computed: mapState(['admin', 'auth']),
|
||||
async asyncData({ app, params }) {
|
||||
await app.store.dispatch('admin/fetchFile', params.id);
|
||||
},
|
||||
methods: {
|
||||
promptDisableUser() {
|
||||
this.$buefy.dialog.confirm({
|
||||
|
|
|
@ -133,17 +133,13 @@ export default {
|
|||
components: {
|
||||
Sidebar
|
||||
},
|
||||
middleware: ['auth', 'admin', ({ store }) => {
|
||||
try {
|
||||
store.dispatch('admin/fetchSettings');
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(e);
|
||||
}
|
||||
}],
|
||||
middleware: ['auth', 'admin'],
|
||||
computed: mapState({
|
||||
settings: state => state.admin.settings
|
||||
}),
|
||||
async asyncData({ app }) {
|
||||
await app.store.dispatch('admin/fetchSettings');
|
||||
},
|
||||
methods: {
|
||||
promptRestartService() {
|
||||
this.$buefy.dialog.confirm({
|
||||
|
|
|
@ -78,16 +78,13 @@ export default {
|
|||
detailed,
|
||||
generic
|
||||
},
|
||||
middleware: ['auth', 'admin', ({ store }) => {
|
||||
try {
|
||||
store.dispatch('admin/fetchStatistics');
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}],
|
||||
middleware: ['auth', 'admin'],
|
||||
computed: mapState({
|
||||
stats: state => state.admin.statistics
|
||||
}),
|
||||
async asyncData({ app }) {
|
||||
await app.store.dispatch('admin/fetchStatistics');
|
||||
},
|
||||
methods: {
|
||||
refresh(category) {
|
||||
try {
|
||||
|
|
|
@ -95,14 +95,7 @@ export default {
|
|||
Sidebar,
|
||||
Grid
|
||||
},
|
||||
middleware: ['auth', 'admin', ({ route, store }) => {
|
||||
try {
|
||||
store.dispatch('admin/fetchUser', { id: route.params.id });
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(e);
|
||||
}
|
||||
}],
|
||||
middleware: ['auth', 'admin'],
|
||||
data() {
|
||||
return {
|
||||
options: {},
|
||||
|
@ -121,6 +114,9 @@ export default {
|
|||
watch: {
|
||||
current: 'fetchPaginate'
|
||||
},
|
||||
async asyncData({ app, params }) {
|
||||
await app.store.dispatch('admin/fetchUser', { id: params.id });
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
fetch: 'admin/fetchUser'
|
||||
|
|
|
@ -143,14 +143,7 @@ export default {
|
|||
components: {
|
||||
Sidebar
|
||||
},
|
||||
middleware: ['auth', 'admin', ({ route, store }) => {
|
||||
try {
|
||||
store.dispatch('admin/fetchUsers', route.params.id);
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(e);
|
||||
}
|
||||
}],
|
||||
middleware: ['auth', 'admin'],
|
||||
data() {
|
||||
return {
|
||||
isCreateUserOpen: false,
|
||||
|
@ -163,6 +156,9 @@ export default {
|
|||
users: state => state.admin.users,
|
||||
config: state => state.config
|
||||
}),
|
||||
async asyncData({ app, params }) {
|
||||
await app.store.dispatch('admin/fetchUsers', params.id);
|
||||
},
|
||||
methods: {
|
||||
async changeEnabledStatus(row) {
|
||||
if (row.enabled) {
|
||||
|
|
|
@ -76,7 +76,6 @@ export default {
|
|||
},
|
||||
middleware: ['auth', ({ route, store }) => {
|
||||
store.commit('images/resetState');
|
||||
store.dispatch('images/fetchByAlbumId', { id: route.params.id });
|
||||
}],
|
||||
data() {
|
||||
return {
|
||||
|
@ -101,6 +100,9 @@ export default {
|
|||
watch: {
|
||||
current: 'fetchPaginate'
|
||||
},
|
||||
async asyncData({ app, params }) {
|
||||
await app.store.dispatch('images/fetchByAlbumId', { id: params.id });
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
fetch: 'images/fetchByAlbumId'
|
||||
|
|
|
@ -55,13 +55,7 @@ export default {
|
|||
Sidebar,
|
||||
AlbumEntry
|
||||
},
|
||||
middleware: ['auth', ({ store }) => {
|
||||
try {
|
||||
store.dispatch('albums/fetch');
|
||||
} catch (e) {
|
||||
this.alert({ text: e.message, error: true });
|
||||
}
|
||||
}],
|
||||
middleware: ['auth'],
|
||||
data() {
|
||||
return {
|
||||
newAlbumName: null,
|
||||
|
@ -69,6 +63,9 @@ export default {
|
|||
};
|
||||
},
|
||||
computed: mapState(['config', 'albums']),
|
||||
async asyncData({ app }) {
|
||||
await app.store.dispatch('albums/fetch');
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
alert: 'alert/set'
|
||||
|
|
|
@ -68,7 +68,6 @@ export default {
|
|||
},
|
||||
middleware: ['auth', ({ store }) => {
|
||||
store.commit('images/resetState');
|
||||
store.dispatch('images/fetch');
|
||||
}],
|
||||
data() {
|
||||
return {
|
||||
|
@ -88,7 +87,10 @@ export default {
|
|||
watch: {
|
||||
current: 'fetchPaginate'
|
||||
},
|
||||
created() {
|
||||
async asyncData({ app }) {
|
||||
await app.store.dispatch('images/fetch');
|
||||
},
|
||||
mounted() {
|
||||
this.filteredHints = this.hints; // fixes the issue where on pageload, suggestions wont load
|
||||
},
|
||||
methods: {
|
||||
|
|
Loading…
Reference in New Issue