type Tokens = {
  access_token: string;
  refresh_token: string;
};

export const getTokens = (): Tokens | null => {
  try {
    const storage: string | null = localStorage.getItem("tokens");

    if (storage === null) {
      throw new Error("Tokens not found");
    }

    const parsed: Tokens = JSON.parse(storage);
    return parsed;
  } catch (error: any) {
    console.error("Error retrieving tokens:", error.message);
    return null;
  }
};
