export const getAuth = async () => {
  const token = localStorage.getItem("admin_token");
  const userStr = localStorage.getItem("admin_user");

  if (token && userStr) {
    try {
      const user = JSON.parse(userStr);
      return { token, user };
    } catch (error) {
      localStorage.removeItem("admin_token");
      localStorage.removeItem("admin_refresh_token");
      localStorage.removeItem("admin_user");
      localStorage.removeItem("admin_permissions");
      return null;
    }
  }

  return null;
};
