fix client init

This commit is contained in:
jb-alvarado 2024-08-22 19:56:05 +02:00
parent 4d38a74306
commit 90dcd3b23e
3 changed files with 7 additions and 5 deletions

View File

@ -5,3 +5,8 @@
</NuxtLayout> </NuxtLayout>
</div> </div>
</template> </template>
<script setup lang="ts">
const configStore = useConfig()
await useAsyncData('init', () => configStore.configInit())
</script>

View File

@ -14,14 +14,11 @@
<script setup lang="ts"> <script setup lang="ts">
const colorMode = useColorMode() const colorMode = useColorMode()
const configStore = useConfig()
const authStore = useAuth() const authStore = useAuth()
const indexStore = useIndex() const indexStore = useIndex()
const route = useRoute() const route = useRoute()
await configStore.nuxtClientInit()
if (colorMode.value === 'dark') { if (colorMode.value === 'dark') {
indexStore.darkMode = true indexStore.darkMode = true
} else { } else {

View File

@ -20,14 +20,14 @@ export const useConfig = defineStore('config', {
getters: {}, getters: {},
actions: { actions: {
async nuxtClientInit() { async configInit() {
const authStore = useAuth() const authStore = useAuth()
authStore.inspectToken() authStore.inspectToken()
if (authStore.isLogin) { if (authStore.isLogin) {
await authStore.obtainUuid() await authStore.obtainUuid()
this.getChannelConfig().then(async () => { await this.getChannelConfig().then(async () => {
await this.getPlayoutConfig() await this.getPlayoutConfig()
await this.getUserConfig() await this.getUserConfig()