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
+6 -3
View File
@@ -10,10 +10,13 @@ const App = () => {
const [isInitialSetup, setIsInitialSetup] = useState(false);
useEffect(() => {
// Tự động xác định địa chỉ IP của Backend dựa trên hostname hiện tại
const API_BASE = `http://${window.location.hostname}:3001`;
// Kiểm tra xem hệ thống đã được cài đặt chưa
fetch('http://localhost:3001/api/v1/auth/status')
.then(res => res.json())
.then(data => setIsInitialSetup(data.isInitialSetup))
fetch(`${API_BASE}/api/v1/auth/status`)
.then(res => res.ok ? res.json() : Promise.reject())
.then(data => setIsInitialSetup(!!data.isInitialSetup))
.catch(() => setIsInitialSetup(false));
}, [view]);