Skip to content

Commit cb563c2

Browse files
committed
feat: implement general settings skeleton
1 parent a533008 commit cb563c2

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

src/router/index.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import Mentions from '@/views/Mentions.vue'
1616
import Messages from '@/views/Messages.vue'
1717
import PostSearch from '@/views/PostSearch.vue'
1818
import Join from '@/views/Join.vue'
19+
import GeneralSettings from '@/views/admin/GeneralSettings.vue'
1920
import ConfirmAccount from '@/views/ConfirmAccount.vue'
2021
import ResetPassword from '@/views/ResetPassword.vue'
2122
import Profile from '@/views/Profile.vue'
@@ -30,6 +31,13 @@ import { localStorageAuth } from '@/composables/stores/auth'
3031
import BanStore from '@/composables/stores/ban'
3132

3233
const routes = [
34+
{
35+
path: '/admin/settings',
36+
alias: '/admin',
37+
name: 'GeneralSettings',
38+
component: GeneralSettings,
39+
meta: { requiresAuth: true, bodyClass: 'general-settings' }
40+
},
3341
{
3442
path: '/',
3543
name: 'Boards',
@@ -216,8 +224,6 @@ router.beforeEach(to => {
216224
BanStore.initBanNotice(localStorageAuth().data)
217225

218226
// Redirect to login page if route has meta.requiresAuth set
219-
console.log(to)
220-
221227
if (to.meta.requiresAuth && !localStorageAuth().data.token) {
222228
router.push({
223229
name: 'Login',

src/views/admin/GeneralSettings.vue

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<template>
2+
<h1>General Settings</h1>
3+
<div class="description">Hello World</div>
4+
{{config}}
5+
</template>
6+
7+
<script>
8+
import { reactive, toRefs } from 'vue'
9+
import { adminApi } from '@/api'
10+
11+
export default {
12+
name: 'GeneralSettings',
13+
beforeRouteEnter(to, from, next) {
14+
adminApi.configurations().then(data => next(vm => vm.config = data))
15+
},
16+
beforeRouteUpdate(to, from, next) {
17+
adminApi.configurations().then(data => {
18+
this.config = data
19+
next()
20+
})
21+
},
22+
setup() {
23+
const v = reactive({ config: {} })
24+
return { ...toRefs(v) }
25+
}
26+
}
27+
</script>
28+
29+
<style lang="scss">
30+
.general-settings {
31+
main #public-content {
32+
max-width: unset;
33+
grid-template-areas: 'header header' 'main main' 'main main';
34+
}
35+
}
36+
</style>

0 commit comments

Comments
 (0)