diff --git a/browser-domain/src/App.tsx b/browser-domain/src/App.tsx index 20da666..b5995c3 100644 --- a/browser-domain/src/App.tsx +++ b/browser-domain/src/App.tsx @@ -8,7 +8,7 @@ import useAuth, { AuthProvider } from "./useAuth"; import { EditFlight } from "./components/CreateFlight/EditFlight"; function Router() { - const { user, logout, isAirline } = useAuth(); + const { user, logout, isAirline, isAdmin } = useAuth(); return (
@@ -17,7 +17,7 @@ function Router() { } /> : } /> : } /> - : } /> + : } /> : } />
diff --git a/browser-domain/src/components/Home/Card/Card.tsx b/browser-domain/src/components/Home/Card/Card.tsx index 696712a..051ed9b 100644 --- a/browser-domain/src/components/Home/Card/Card.tsx +++ b/browser-domain/src/components/Home/Card/Card.tsx @@ -24,12 +24,13 @@ interface CardProps { subscribed: boolean; refresh: any; isAirline: boolean; + isAdmin: boolean; refreshFlights: any; } const { Text } = Typography; -export const Card: React.FC = ({ flight, user, subscribed, refresh, refreshFlights, isAirline }) => { +export const Card: React.FC = ({ flight, user, subscribed, refresh, refreshFlights, isAirline, isAdmin }) => { const [modalVisible, setModalVisible] = useState(false); const navigate = useNavigate(); @@ -81,7 +82,6 @@ export const Card: React.FC = ({ flight, user, subscribed, refresh, r editFlight("" + flight.id, data, token) .then(() => { - console.log("culicagado") refreshFlights() }) .catch((error) => { @@ -158,7 +158,7 @@ export const Card: React.FC = ({ flight, user, subscribed, refresh, r {flight.id}
- {!isAirline ? + {!isAirline && !isAdmin ? ( !(subscribed) ?
diff --git a/browser-domain/src/useAuth.tsx b/browser-domain/src/useAuth.tsx index 4415a47..0323f4d 100644 --- a/browser-domain/src/useAuth.tsx +++ b/browser-domain/src/useAuth.tsx @@ -8,6 +8,7 @@ interface AuthContextType { user?: User; loading: boolean; isAirline: boolean; + isAdmin: boolean; token?: string; error?: any; login: (credentials: Credentials) => void; @@ -105,13 +106,14 @@ export function AuthProvider({ user, loading, isAirline, + isAdmin, token, error, login, signUp, logout, }), - [user, isAirline, loading, error] + [user, isAirline, isAdmin, loading, error] ); return (