Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Pewiz/ulagos360/llms.txt

Use this file to discover all available pages before exploring further.

Logging out of ULagos 360° is a deliberate reset operation: it severs the Socket.IO connection, removes all locally stored session and spaces data, and resets every space in the Zustand store back to disponible. The page then reloads automatically and the identification modal appears so the next tutor can start a fresh session from the server’s current state.

Logout Steps

1

Click the LogOut icon in the header

Inside the user chip (the rounded badge showing your name), locate the red LogOut icon on the far right. Click it to begin the logout flow.
2

Confirm the dialog

A browser confirmation dialog appears:
¿Cerrar sesión? ¿Estás seguro de que quieres limpiar todos los datos? Esto reiniciará la aplicación.
Click Aceptar to proceed or Cancelar to abort.
// src/components/Header.jsx
const handleClearData = () => {
  if (
    window.confirm(
      "¿Cerrar sesión? ¿Estás seguro de que quieres limpiar todos los datos? Esto reiniciará la aplicación."
    )
  ) {
    onClearData();
    onLogout();
  }
};
3

Session teardown executes

After confirmation, handleLogout from useRealTimeSpaces.js runs the following sequence:
// src/hooks/useRealTimeSpaces.js
const handleLogout = useCallback(() => {
  // 1. Mark logout in progress to suppress auto-reconnect
  localStorage.setItem("logout_in_progress", "true");

  // 2. Disconnect the socket immediately
  disconnectSocket();

  // 3. Clear all localStorage keys
  localStorage.removeItem("ulagos360_current_user");
  localStorage.removeItem("currentUser");
  localStorage.removeItem("spaces-storage");
  localStorage.removeItem("sessionId");
  localStorage.removeItem("ulagos360_session_id");
  localStorage.removeItem("lastStateSync");
  localStorage.removeItem("ulagos360_spaces_backup");
  localStorage.removeItem("ulagos360_emergency_backup");

  // 4. Reset the Zustand store (clears state and sets all spaces to disponible)
  logout();

  // 5. Reload after 500 ms
  setTimeout(() => {
    localStorage.removeItem("logout_in_progress");
    window.location.reload();
  }, 500);
}, [logout, disconnectSocket]);
The logout() call resets the Zustand store — it clears persisted keys and reinitialises every space to disponible:
// src/stores/spacesStore.js  — logout action
logout: () => {
  // Remove all persisted keys
  localStorage.removeItem("ulagos360_current_user");
  localStorage.removeItem("ulagos360_session_id");
  localStorage.removeItem("spaces-storage");
  localStorage.removeItem("ulagos360_spaces_backup");
  localStorage.removeItem("ulagos360_emergency_backup");
  localStorage.removeItem("lastStateSync");

  // Reset every space to "disponible"
  const initialSpaces = {};
  Object.entries(SPACES_DATA).forEach(([category, spacesList]) => {
    spacesList.forEach((space) => {
      initialSpaces[space.id] = {
        ...space,
        status: SPACE_STATUS.DISPONIBLE,
        occupiedBy: null,
        reservedBy: null,
        lastUpdate: new Date().toISOString(),
        updatedBy: null,
        category,
        type: category,
      };
    });
  });

  set({ spaces: initialSpaces, currentUser: null, loading: false });
},
4

Page reloads and the identification modal appears

After 500 ms the page reloads. Because ulagos360_current_user and currentUser have been removed from localStorage, Header.jsx detects that currentUser is null and opens the identification modal automatically so the next tutor can enter their name.

localStorage Keys Cleared on Logout

KeyPurpose
ulagos360_current_userTutor identity (primary key)
currentUserLegacy tutor identity key
spaces-storageZustand persisted spaces state
sessionIdSocket session identifier
ulagos360_session_idSession ID (secondary key)
lastStateSyncTimestamp of last server sync
ulagos360_spaces_backupPrimary spaces backup
ulagos360_emergency_backupEmergency backup with metadata

Logout vs. Connection Drop

ScenarioSocket disconnectedLocal data clearedStore reset
Voluntary logout✅ Yes✅ Yes✅ Yes
Network / connection dropAuto (server-side timeout)❌ No❌ No
A voluntary logout explicitly disconnects the socket and wipes all local state so the device is clean for the next tutor. A connection drop is handled separately by the server’s disconnect event — the tutor’s local data remains intact for the auto-reconnect flow.
Logging out clears all local data including the current spaces snapshot and both backup keys. If you log out mid-event, any space states that have not yet been acknowledged by the server will be lost from your device. All other connected tutors are unaffected — only your local copy is reset.
After logout, the next tutor who opens the app on the same device will start with a clean local state and immediately receive the server’s authoritative space states via the get_all_spaces request that fires on every new connection.

Build docs developers (and LLMs) love