Cài đặt thành công tính năng người dùng đầu tiên phải đăng ký tài khoản để quản lí

This commit is contained in:
2026-06-13 17:45:49 +07:00
parent 6913bbae48
commit ee5a5b6800
10 changed files with 21 additions and 12 deletions
Vendored
+4 -3
View File
@@ -8,9 +8,10 @@ const App = () => {
const [view, setView] = useState('landing');
const [isInitialSetup, setIsInitialSetup] = useState(false);
useEffect(() => {
fetch('http://localhost:3001/api/v1/auth/status')
.then(res => res.json())
.then(data => setIsInitialSetup(data.isInitialSetup))
const API_BASE = `http://${window.location.hostname}:3001`;
fetch(`${API_BASE}/api/v1/auth/status`)
.then(res => res.ok ? res.json() : Promise.reject())
.then(data => setIsInitialSetup(!!data.isInitialSetup))
.catch(() => setIsInitialSetup(false));
}, [view]);
return (_jsxs("div", { className: "app-container", children: [view === 'landing' && (_jsx(LandingPage, { isInitialSetup: isInitialSetup, onContinue: () => setView('explore'), onGoToSignup: () => setView('signup'), onGoToMap: () => setView('explore') })), view === 'signup' && (_jsx(SignupPage, { onBack: () => setView('landing'), onSuccess: () => setView('landing') })), view === 'explore' && (_jsx(ExploreMap, { onBack: () => setView('landing') })), view === 'detail' && (_jsx(TourDetailPage, {}))] }));