export async function clearOdooSession(baseUrl: string) { try { if (baseUrl) { await fetch(`${baseUrl}/web/session/destroy`, { method: "POST", credentials: "include", headers: { "Content-Type": "application/json" }, body: "{}", }); } } catch { } // 2) hapus cookie session_id di browser try { const del = (name: string, domain?: string) => { const d = domain ? `; domain=${domain}` : ""; document.cookie = `${name}=; Max-Age=0; Path=/${d}`; document.cookie = `${name}=; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=/${d}`; }; const host = window.location.hostname.replace(/^www\./, ""); const parts = host.split("."); const parent = parts.length >= 2 ? `.${parts.slice(-2).join(".")}` : undefined; [undefined, host, parent].forEach(dom => del("session_id", dom)); } catch { } }