Fix Login saving old user state

This commit is contained in:
Lucas Schumacher 2023-11-07 12:57:21 -05:00
parent 9244e94dd7
commit 784dd60bef
2 changed files with 3 additions and 2 deletions

View File

@ -2,7 +2,7 @@
import ThemeToggle from './ThemeToggle.vue'
const props = defineProps(['modelValue'])
defineEmits(['update:modelValue'])
const emit = defineEmits(['update:modelValue'])
async function signout(ev) {
ev.preventDefault()
@ -16,6 +16,7 @@ async function signout(ev) {
}
let resp = await fetch(api_url, fetch_options)
console.log(resp)
emit('update:modelValue', '')
window.location.reload()
}
</script>

View File

@ -22,7 +22,7 @@ async function login(ev) {
let resp = await fetch(api_url, fetch_options)
if (resp.ok) {
emit('update:modelValue', user.value)
emit('update:modelValue', await resp.json())
window.location.hash = "/"
} else {
user.value = ''