fix: account info updates on route update

This commit is contained in:
niko
2025-05-26 06:24:04 -04:00
parent a5d00da6ea
commit 6f9bc946b3

View File

@@ -29,11 +29,12 @@ interface InfoCCResponse {
}
const route = useRoute();
const accountInfo = await useFetch<InfoCCResponse>('/api/account/info'); // TODO: does doing this cause too many requests? can't depend on route due to hydration issues
const accountInfo = await useFetch<InfoCCResponse>('/api/account/info', { watch: [() => route.path] }); // TODO: does doing this cause too many requests?
async function logoutClick() {
await $fetch('/api/account/logout');
accountInfo.clear();
accountInfo.clear(); // manually clear since redirect is only going to happen on the account page
if (route.path == '/account') {
navigateTo('/');