From a3bf693d30d3c1c1d9e4073830522554c3f1c4e8 Mon Sep 17 00:00:00 2001
From: Pitu <heyitspitu@gmail.com>
Date: Wed, 20 Jan 2021 14:09:06 +0900
Subject: chore: switch to asyncData where needed

---
 src/site/pages/dashboard/admin/settings.vue | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

(limited to 'src/site/pages/dashboard/admin/settings.vue')

diff --git a/src/site/pages/dashboard/admin/settings.vue b/src/site/pages/dashboard/admin/settings.vue
index 0a43dcd..038c495 100644
--- a/src/site/pages/dashboard/admin/settings.vue
+++ b/src/site/pages/dashboard/admin/settings.vue
@@ -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({
-- 
cgit v1.2.3

