diff --git a/auth-domain/user-manager/src/__init__.py b/auth-domain/user-manager/src/__init__.py index 56494b1..ceab26b 100644 --- a/auth-domain/user-manager/src/__init__.py +++ b/auth-domain/user-manager/src/__init__.py @@ -40,6 +40,7 @@ def create_app(script_info=None): app_settings = os.getenv("APP_SETTINGS") app.config.from_object(app_settings) + app.config["ERROR_404_HELP"] = False db.init_app(app) cors.init_app(app, resources={r"*": {"origins": "*"}}) diff --git a/browser-domain/src/Api.ts b/browser-domain/src/Api.ts index c70ac89..db1c2be 100644 --- a/browser-domain/src/Api.ts +++ b/browser-domain/src/Api.ts @@ -133,4 +133,4 @@ export const fetchSubscriptions = (user_id: number, token: string): Promise { - setError(error as string); + try { + setError(JSON.parse(error.response.data)["detail"] as string); + } catch {} }); }; return (
+ {error && +
+

Error: {error}

+
+ } - +
); }; diff --git a/browser-domain/src/components/CreateFlight/EditFlight.tsx b/browser-domain/src/components/CreateFlight/EditFlight.tsx index ccb8505..b1ddb50 100644 --- a/browser-domain/src/components/CreateFlight/EditFlight.tsx +++ b/browser-domain/src/components/CreateFlight/EditFlight.tsx @@ -1,9 +1,8 @@ -import React, { useEffect, useState } from "react"; -import { FlightEditNotNull, Flight, FlightEdit } from "../../Types"; +import React, { useState } from "react"; +import { FlightEditNotNull, Flight } from "../../Types"; import { useNavigate, useParams } from "react-router"; import "./FlightForm.css"; -import { createFlight, editFlight } from "../../Api"; -import { useFetchFlight } from "../../hooks/useFetchFlight"; +import { editFlight } from "../../Api"; interface Props { flight?: Flight; @@ -13,9 +12,6 @@ export const EditFlight: React.FC = (props) => { const navigate = useNavigate(); let { id } = useParams(); const [error, setError] = useState(null); - const [flight, setFlight] = useState(); - - const { flight: initialData } = useFetchFlight(id); const [flightData, setFlightData] = useState({ status: "", @@ -56,17 +52,22 @@ export const EditFlight: React.FC = (props) => { editFlight(id, data, token) .then((data) => { - setFlight(data); navigate("/home") }) .catch((error) => { - setError(error as string); + try { + setError(JSON.parse(error.response.data)["detail"] as string); + } catch {} }); }; return (
- + {error && +
+

Error: {error}

+
+ }