"use client";
export function getTokenFromLocalStorage(): string {
    if (typeof window !== "undefined") {
        if (!localStorage) {
            throw new Error("Local storage not found");
        }

        // Get the stored data from local storage
        const storedData = localStorage.getItem("site-session-token");

        // Parse the stored data as JSON
        const jsonData = storedData ? JSON.parse(storedData) : null;

        // If jsonData is truthy, return the token value
        if (jsonData) {
            return jsonData.state.token;
        }
    }

    // Return an empty string if no token is found
    return "";
}
