Fix Login saving old user state
This commit is contained in:
parent
9244e94dd7
commit
784dd60bef
@ -2,7 +2,7 @@
|
|||||||
import ThemeToggle from './ThemeToggle.vue'
|
import ThemeToggle from './ThemeToggle.vue'
|
||||||
|
|
||||||
const props = defineProps(['modelValue'])
|
const props = defineProps(['modelValue'])
|
||||||
defineEmits(['update:modelValue'])
|
const emit = defineEmits(['update:modelValue'])
|
||||||
|
|
||||||
async function signout(ev) {
|
async function signout(ev) {
|
||||||
ev.preventDefault()
|
ev.preventDefault()
|
||||||
@ -16,6 +16,7 @@ async function signout(ev) {
|
|||||||
}
|
}
|
||||||
let resp = await fetch(api_url, fetch_options)
|
let resp = await fetch(api_url, fetch_options)
|
||||||
console.log(resp)
|
console.log(resp)
|
||||||
|
emit('update:modelValue', '')
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -22,7 +22,7 @@ async function login(ev) {
|
|||||||
|
|
||||||
let resp = await fetch(api_url, fetch_options)
|
let resp = await fetch(api_url, fetch_options)
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
emit('update:modelValue', user.value)
|
emit('update:modelValue', await resp.json())
|
||||||
window.location.hash = "/"
|
window.location.hash = "/"
|
||||||
} else {
|
} else {
|
||||||
user.value = ''
|
user.value = ''
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user