points don't show up when logged out anymore

This commit is contained in:
masongga
2026-05-24 09:23:01 -06:00
parent 8c9d8bb709
commit 8049ee90ae

View File

@@ -33,10 +33,19 @@ export function HeaderCoinBalance() {
}, []);
useEffect(() => {
const supabase = createClient();
void refresh();
const {
data: { subscription },
} = supabase.auth.onAuthStateChange(() => {
void refresh();
});
window.addEventListener(HABIT_PET_DATA_UPDATED_EVENT, refresh);
return () => {
subscription.unsubscribe();
window.removeEventListener(HABIT_PET_DATA_UPDATED_EVENT, refresh);
};
}, [refresh]);