Skip to content

Commit

Permalink
feat: implement general settings skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
akinsey committed Feb 12, 2022
1 parent a533008 commit cb563c2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Mentions from '@/views/Mentions.vue'
import Messages from '@/views/Messages.vue'
import PostSearch from '@/views/PostSearch.vue'
import Join from '@/views/Join.vue'
import GeneralSettings from '@/views/admin/GeneralSettings.vue'
import ConfirmAccount from '@/views/ConfirmAccount.vue'
import ResetPassword from '@/views/ResetPassword.vue'
import Profile from '@/views/Profile.vue'
Expand All @@ -30,6 +31,13 @@ import { localStorageAuth } from '@/composables/stores/auth'
import BanStore from '@/composables/stores/ban'

const routes = [
{
path: '/admin/settings',
alias: '/admin',
name: 'GeneralSettings',
component: GeneralSettings,
meta: { requiresAuth: true, bodyClass: 'general-settings' }
},
{
path: '/',
name: 'Boards',
Expand Down Expand Up @@ -216,8 +224,6 @@ router.beforeEach(to => {
BanStore.initBanNotice(localStorageAuth().data)

// Redirect to login page if route has meta.requiresAuth set
console.log(to)

if (to.meta.requiresAuth && !localStorageAuth().data.token) {
router.push({
name: 'Login',
Expand Down
36 changes: 36 additions & 0 deletions src/views/admin/GeneralSettings.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<template>
<h1>General Settings</h1>
<div class="description">Hello World</div>
{{config}}
</template>

<script>
import { reactive, toRefs } from 'vue'
import { adminApi } from '@/api'
export default {
name: 'GeneralSettings',
beforeRouteEnter(to, from, next) {
adminApi.configurations().then(data => next(vm => vm.config = data))
},
beforeRouteUpdate(to, from, next) {
adminApi.configurations().then(data => {
this.config = data
next()
})
},
setup() {
const v = reactive({ config: {} })
return { ...toRefs(v) }
}
}
</script>

<style lang="scss">
.general-settings {
main #public-content {
max-width: unset;
grid-template-areas: 'header header' 'main main' 'main main';
}
}
</style>

0 comments on commit cb563c2

Please sign in to comment.