refactor: remove pocketbase (#1138)

This commit is contained in:
Jonas Plum
2025-09-02 21:58:08 +02:00
committed by GitHub
parent f28c238135
commit eba2615ec0
435 changed files with 42677 additions and 4730 deletions

View File

@@ -1,5 +1,46 @@
<script setup lang="ts">
import Toaster from '@/components/ui/toast/Toaster.vue'
import { onMounted, watch } from 'vue'
import { RouterView } from 'vue-router'
import { useAuthStore } from '@/store/auth'
const authStore = useAuthStore()
const fetchUser = () => {
if (!authStore.token) {
authStore.setUser(undefined)
authStore.setPermissions([])
return
}
fetch('/auth/user', { headers: { Authorization: `Bearer ${authStore.token}` } }).then(
(response) => {
if (response.ok) {
response.json().then((user) => {
if (user) {
authStore.setUser(user.user)
authStore.setPermissions(user.permissions)
} else {
authStore.setUser(undefined)
authStore.setPermissions([])
}
})
}
}
)
}
onMounted(() => {
fetchUser()
})
watch(
() => authStore.token,
() => fetchUser(),
{ immediate: true }
)
</script>
<template>