diff --git a/packages/berlin/src/App.tsx b/packages/berlin/src/App.tsx
index 717bd705..0fe8c183 100644
--- a/packages/berlin/src/App.tsx
+++ b/packages/berlin/src/App.tsx
@@ -15,9 +15,18 @@ import Onboarding from './pages/Onboarding';
import PassportPopupRedirect from './pages/Popup';
import Holding from './pages/Holding';
import Register from './pages/Register';
+import { useQuery } from '@tanstack/react-query';
+import { fetchEvents } from 'api';
function App() {
const { user, isLoading } = useUser();
+
+ const { data: events } = useQuery({
+ queryKey: ['events'],
+ queryFn: fetchEvents,
+ enabled: !!user?.id,
+ });
+
const onboardingStatus = useAppStore((state) => state.onboardingStatus);
const userStatus = useAppStore((state) => state.userStatus);
const setUserStatus = useAppStore((state) => state.setUserStatus);
@@ -42,8 +51,12 @@ function App() {
return ;
}
+ if (events?.length === 1) {
+ return ;
+ }
+
return ;
- }, [user, userStatus, onboardingStatus]);
+ }, [user, userStatus, onboardingStatus, events]);
// This will be a loading skeleton
if (isLoading) {
diff --git a/packages/berlin/src/hooks/useUser.tsx b/packages/berlin/src/hooks/useUser.tsx
index be2cec74..4c42d690 100644
--- a/packages/berlin/src/hooks/useUser.tsx
+++ b/packages/berlin/src/hooks/useUser.tsx
@@ -9,8 +9,6 @@ function useUser() {
} = useQuery({
queryKey: ['user'],
queryFn: fetchUserData,
- retry: false,
- staleTime: 10000,
});
return { user, isLoading, isError };
diff --git a/packages/berlin/src/pages/Account.tsx b/packages/berlin/src/pages/Account.tsx
index af4c471c..3dc7eaac 100644
--- a/packages/berlin/src/pages/Account.tsx
+++ b/packages/berlin/src/pages/Account.tsx
@@ -223,7 +223,7 @@ function AccountForm({
toast.success('User data updated!');
- if (events?.length ?? 0 > 1) {
+ if (events?.length === 1) {
navigate(`/events/${events?.[0].id}/register`);
}
}
@@ -403,9 +403,7 @@ function AccountForm({
/>
)}
/>
-
+
diff --git a/packages/berlin/src/pages/Holding.tsx b/packages/berlin/src/pages/Holding.tsx
index e0c357a1..425b5107 100644
--- a/packages/berlin/src/pages/Holding.tsx
+++ b/packages/berlin/src/pages/Holding.tsx
@@ -15,7 +15,7 @@ function Holding() {
const handleRegistrationClick = () => {
navigate(`/events/${eventId}/register`);
window.location.reload();
- }
+ };
return (
@@ -24,7 +24,10 @@ function Holding() {
We will inform you of the status by April 15, at the latest.
If you need to edit your submission, then{' '}
- click here.
+
+ click here
+
+ .
);
diff --git a/packages/berlin/src/pages/Onboarding.tsx b/packages/berlin/src/pages/Onboarding.tsx
index dbd9f979..d6e5e385 100644
--- a/packages/berlin/src/pages/Onboarding.tsx
+++ b/packages/berlin/src/pages/Onboarding.tsx
@@ -13,15 +13,17 @@ import Dots from '../components/dots';
// Data
import onboarding from '../data/onboarding';
+import { useAppStore } from '../store';
function Onboarding() {
const navigate = useNavigate();
-
+ const setOnboardingStatus = useAppStore((state) => state.setOnboardingStatus);
const [step, setStep] = useState(0);
const { data } = onboarding;
const handleSkip = () => {
navigate('/account');
+ setOnboardingStatus('COMPLETE');
};
const handleNext = () => {