Fix websockets and vite hmr on local dev

This commit is contained in:
Kasper Seweryn 2022-05-03 02:53:02 +02:00 committed by Georg Krause
parent 0b53ec5b1c
commit 461aa51e03
3 changed files with 7 additions and 4 deletions

View File

@ -29,7 +29,7 @@
</li> </li>
</ul> </ul>
</div> </div>
<template v-if="document.domain === $store.getters['instance/domain']"> <template v-if="domain === $store.getters['instance/domain']">
<div class="field"> <div class="field">
<label for="username-field"> <label for="username-field">
<translate translate-context="Content/Login/Input.Label/Noun">Username or e-mail address</translate> <translate translate-context="Content/Login/Input.Label/Noun">Username or e-mail address</translate>
@ -110,7 +110,8 @@ export default {
password: '' password: ''
}, },
error: '', error: '',
isLoading: false isLoading: false,
domain: document.domain
} }
}, },
computed: { computed: {

View File

@ -13,9 +13,10 @@ export const install: InitModule = ({ store }) => {
}) })
watch(() => store.state.auth.authenticated, (authenticated) => { watch(() => store.state.auth.authenticated, (authenticated) => {
console.log(Math.random())
if (authenticated) return open() if (authenticated) return open()
close() close()
}) }, { immediate: true })
whenever(data, () => { whenever(data, () => {
return store.dispatch('ui/websocketEvent', JSON.parse(data.value)) return store.dispatch('ui/websocketEvent', JSON.parse(data.value))
@ -24,5 +25,5 @@ export const install: InitModule = ({ store }) => {
watchEffect(() => { watchEffect(() => {
console.log('Websocket status:', status.value) console.log('Websocket status:', status.value)
}) })
}) }, { immediate: true })
} }

View File

@ -55,4 +55,5 @@ Promise.all(modules).finally(() => {
// TODO (wvffle): Find all array watchers and make them deep // TODO (wvffle): Find all array watchers and make them deep
// TODO (wvffle): Migrate to <script setup lang="ts"> and remove allowJs from tsconfig.json // TODO (wvffle): Migrate to <script setup lang="ts"> and remove allowJs from tsconfig.json
// TODO (wvffle): Replace `from '(../)+` with `from '~/` // TODO (wvffle): Replace `from '(../)+` with `from '~/`
// TODO (wvffle): Fix props not being available in template in IntelliJ Idea
// TODO (wvffle): Use navigation guards // TODO (wvffle): Use navigation guards