use p2p_token everywhere; drop shared zino_token to avoid cross-app corruption

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Bhanu Prakash Sai Potteri 2026-06-22 15:42:38 +05:30
parent 98afb6ad07
commit cc997838bb
3 changed files with 3 additions and 6 deletions

View File

@ -1,6 +1,6 @@
import { APP_ID } from "../config";
const TOKEN_KEY = "zino_token";
const TOKEN_KEY = "p2p_token";
function baseUrl(): string {
return (import.meta.env.VITE_ZINO_API_URL || "https://studio.getzino.in").replace(/\/+$/, "");
@ -21,7 +21,7 @@ async function request<T>(method: string, path: string, body?: unknown): Promise
});
if (res.status === 401) {
localStorage.removeItem(TOKEN_KEY);
localStorage.removeItem("zino_user");
localStorage.removeItem("p2p_user");
window.location.href = `${import.meta.env.BASE_URL}login`;
throw new Error("Unauthorized");
}

View File

@ -62,8 +62,6 @@ export function useAuth() {
localStorage.setItem(TOKEN_KEY, token);
localStorage.setItem(USER_KEY, JSON.stringify(user));
// Also set on zino SDK so workflow/view calls get the token
localStorage.setItem("zino_token", token);
setState({ user, token, loading: false, error: null });
return { token, user };
@ -79,7 +77,6 @@ export function useAuth() {
const logout = useCallback(() => {
localStorage.removeItem(TOKEN_KEY);
localStorage.removeItem(USER_KEY);
localStorage.removeItem("zino_token");
setState({ user: null, token: null, loading: false, error: null });
}, []);

View File

@ -1,6 +1,6 @@
import type { ApiError, ZinoClientConfig } from "./types";
const TOKEN_KEY = "zino_token";
const TOKEN_KEY = "p2p_token";
/**
* Core HTTP client for the Zino API.