Fix lots of bugs and update frontend(s)
This commit is contained in:
parent
b3cc4d4cc3
commit
53207f1dd6
|
@ -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": "*"}})
|
||||
|
|
|
@ -36,12 +36,19 @@ export const CreateFlight = () => {
|
|||
navigate("/home")
|
||||
})
|
||||
.catch((error) => {
|
||||
setError(error as string);
|
||||
try {
|
||||
setError(JSON.parse(error.response.data)["detail"] as string);
|
||||
} catch {}
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit}>
|
||||
{error &&
|
||||
<div className="form-error">
|
||||
<p><strong>Error:</strong> {error}</p>
|
||||
</div>
|
||||
}
|
||||
<label>
|
||||
Flight Code:
|
||||
<input
|
||||
|
@ -117,7 +124,7 @@ export const CreateFlight = () => {
|
|||
onChange={(e) => setFlightData({ ...flightData, gate: e.target.value })}
|
||||
/>
|
||||
</label>
|
||||
<button name="CreateFlightButton" type="submit">Submit</button>
|
||||
<button name="CreateFlightButton" type="submit">Create</button>
|
||||
</form>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -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> = (props) => {
|
|||
const navigate = useNavigate();
|
||||
let { id } = useParams();
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [flight, setFlight] = useState<Flight>();
|
||||
|
||||
const { flight: initialData } = useFetchFlight(id);
|
||||
|
||||
const [flightData, setFlightData] = useState<FlightEditNotNull>({
|
||||
status: "",
|
||||
|
@ -56,17 +52,22 @@ export const EditFlight: React.FC<Props> = (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 (
|
||||
<form onSubmit={handleSubmit}>
|
||||
|
||||
{error &&
|
||||
<div className="form-error">
|
||||
<p><strong>Error:</strong> {error}</p>
|
||||
</div>
|
||||
}
|
||||
<label>
|
||||
Status:
|
||||
<input
|
||||
|
|
|
@ -7,17 +7,6 @@ import "./Card.css";
|
|||
import { getChatId, getSubscription, subscribeToFlight, unsubscribeFromFlight, editFlight } from "../../../Api";
|
||||
import { Flight, FlightEdit, User } from "../../../Types";
|
||||
|
||||
// interface FlightProps {
|
||||
// id: number;
|
||||
// flight_code: string;
|
||||
// status: string;
|
||||
// origin: string;
|
||||
// destination: string;
|
||||
// departure_time: string;
|
||||
// arrival_time: string;
|
||||
// gate: string;
|
||||
// }
|
||||
|
||||
interface CardProps {
|
||||
flight: Flight;
|
||||
user: User | undefined;
|
||||
|
@ -128,18 +117,16 @@ export const Card: React.FC<CardProps> = ({ flight, user, subscribed, refresh, r
|
|||
<Text strong>Status:</Text>
|
||||
<Tag color={flight.status === "Scheduled" ? "green" : "orange"}>{flight.status}</Tag>
|
||||
</Space>
|
||||
<Space size={8} direction="vertical">
|
||||
<Space size={8} direction="horizontal">
|
||||
<Text strong>Departure:</Text>
|
||||
<Space size={2} align="baseline">
|
||||
<CalendarOutlined />
|
||||
{flight.departure_time}
|
||||
<Text>{flight.departure_time}</Text>
|
||||
</Space>
|
||||
</Space>
|
||||
<Space size={8} direction="vertical">
|
||||
<Space size={8} direction="horizontal">
|
||||
<Text strong>Arrival:</Text>
|
||||
<Space size={2} align="baseline">
|
||||
<CalendarOutlined />
|
||||
{flight.arrival_time}
|
||||
<Text>{flight.arrival_time}</Text>
|
||||
</Space>
|
||||
</Space>
|
||||
<Space size={8} direction="horizontal">
|
||||
|
@ -147,39 +134,44 @@ export const Card: React.FC<CardProps> = ({ flight, user, subscribed, refresh, r
|
|||
<Text>{flight.gate}</Text>
|
||||
</Space>
|
||||
<Space size={8} direction="horizontal">
|
||||
<Text strong>ID:</Text>
|
||||
<Text strong>Flight ID:</Text>
|
||||
<Text>{flight.id}</Text>
|
||||
</Space>
|
||||
{((!isAirline && !isAdmin) || ((user && flight.user_id == user.id) || isAdmin)) && <br></br>}
|
||||
</div>
|
||||
{!isAirline && !isAdmin ?
|
||||
(
|
||||
!(subscribed) ?
|
||||
<Space size={8} direction="horizontal" style={{ justifyContent: "center" }}>
|
||||
<Button type="primary" onClick={handleSubscribe}>
|
||||
Subscribe
|
||||
</Button>
|
||||
</Space>
|
||||
:
|
||||
<Space size={8} direction="horizontal" style={{ justifyContent: "center" }}>
|
||||
<Button type="primary" onClick={handleUnsubscribe}>
|
||||
Unsubscribe
|
||||
</Button>
|
||||
</Space>
|
||||
)
|
||||
:
|
||||
(
|
||||
(user && flight.user_id == user.id) || isAdmin ?
|
||||
<>
|
||||
<Space size={8} direction="horizontal" style={{ justifyContent: "center" }}>
|
||||
<Button type="primary" onClick={handleEdit}>
|
||||
Edit
|
||||
</Button>
|
||||
<Button type="primary" onClick={handleDelete}>
|
||||
Delete
|
||||
</Button>
|
||||
</>
|
||||
</Space>
|
||||
:
|
||||
<></>
|
||||
)
|
||||
}
|
||||
<Modal
|
||||
title="Error"
|
||||
visible={modalVisible}
|
||||
title="Attention"
|
||||
open={modalVisible}
|
||||
onCancel={handleModalClose}
|
||||
footer={[
|
||||
<Button key="ok" type="primary" onClick={handleModalClose}>
|
||||
|
|
|
@ -14,7 +14,7 @@ export const Home: React.FC<Props> = (props) => {
|
|||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const origin = urlParams.get('origin');
|
||||
const initialPage = parseInt(urlParams.get('page') || '1', 10);
|
||||
const { flights, count, error, fetchData: refreshFlights } = useFetchFlights(origin, initialPage);
|
||||
const { flights, count, error, isLoading, fetchData: refreshFlights } = useFetchFlights(origin, initialPage);
|
||||
const navigate = useNavigate()
|
||||
|
||||
const [currentPage, setCurrentPage] = useState(initialPage);
|
||||
|
@ -28,6 +28,12 @@ export const Home: React.FC<Props> = (props) => {
|
|||
navigate(`?${newParams.toString()}`);
|
||||
}, [currentPage, navigate]);
|
||||
|
||||
useEffect(() => {
|
||||
if (currentPage > 1 && count == 0) {
|
||||
setCurrentPage(currentPage - 1);
|
||||
}
|
||||
}, [count]);
|
||||
|
||||
const goToPrevPage = () => {
|
||||
if (currentPage > 1) {
|
||||
setCurrentPage(currentPage - 1);
|
||||
|
@ -46,16 +52,18 @@ export const Home: React.FC<Props> = (props) => {
|
|||
return currentPage > 1 ? true : false
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
if (loading || isLoading || subsLoading) {
|
||||
return <div>Loading...</div>;
|
||||
}
|
||||
|
||||
let columns = flights.length >= 4 ? 4 : flights.length
|
||||
|
||||
return (
|
||||
<div className="Box">
|
||||
{isAirline ? <button name="CreateFlight" onClick={() => { navigate("/create-flight") }}>Create flight</button> : <></>}
|
||||
{isAdmin ? <button onClick={() => { navigate("/create-airline") }}>Create airline user</button> : <></>}
|
||||
<h2>Flights</h2>
|
||||
<div className="Items">
|
||||
<div className="Items" style={{ gridTemplateColumns: `repeat(${columns}, minmax(80px, 250px))` }}>
|
||||
{(props.flights ? props.flights : flights).map((f) => {
|
||||
return <Card key={f.id} flight={f} user={user}
|
||||
subscribed={subscriptions.some((i => i.flight_id === f.id))}
|
||||
|
|
|
@ -13,6 +13,7 @@ export const LogIn = () => {
|
|||
<div className="Box Small">
|
||||
<div className="Section">
|
||||
<div className="Section">
|
||||
<h2>Welcome to FIDS!</h2>
|
||||
<Input
|
||||
placeholder="User"
|
||||
name="User"
|
||||
|
@ -34,7 +35,7 @@ export const LogIn = () => {
|
|||
Log in
|
||||
</Button>
|
||||
<Button
|
||||
style={{ width: "100%" }}
|
||||
style={{ width: "100%", marginTop: '20px' }}
|
||||
onClick={() =>
|
||||
navigate("/signup")
|
||||
}
|
||||
|
@ -43,7 +44,7 @@ export const LogIn = () => {
|
|||
Sign up
|
||||
</Button>
|
||||
{error ? (
|
||||
<div className="Disconnected">{error?.message}</div>
|
||||
<div className="Disconnected">{error}</div>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
|
|
|
@ -54,7 +54,7 @@ export const SignUp = () => {
|
|||
Sign up
|
||||
</Button>
|
||||
<Button
|
||||
style={{ width: "100%" }}
|
||||
style={{ width: "100%", marginTop: '20px' }}
|
||||
onClick={() =>
|
||||
navigate("/login")
|
||||
}
|
||||
|
|
|
@ -4,35 +4,32 @@ import { User, Flight } from "../Types";
|
|||
import { fetchFlights } from "../Api";
|
||||
|
||||
export const useFetchFlights = (origin: string | null, page: number | null) => {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [flights, setFlights] = useState<Flight[]>([]);
|
||||
const [count, setCount] = useState<number>(0);
|
||||
|
||||
// useEffect(() => {
|
||||
// setError(null);
|
||||
|
||||
// fetchFlights(origin, page)
|
||||
// .then((data) => {
|
||||
// setCount(data.count)
|
||||
// setFlights(data.flights.filter((e) => e.status != "Deleted" ));
|
||||
// })
|
||||
// .catch((error) => { });
|
||||
// }, [page]);
|
||||
|
||||
const fetchData = useCallback(async () => {
|
||||
setError(null);
|
||||
setIsLoading(true)
|
||||
|
||||
fetchFlights(origin, page)
|
||||
.then((data) => {
|
||||
setCount(data.count)
|
||||
setFlights(data.flights.filter((e) => e.status != "Deleted" ));
|
||||
setFlights(data.flights);
|
||||
})
|
||||
.catch((error) => { });
|
||||
.catch((error) => {
|
||||
if (error.response.status == 404) {
|
||||
setCount(0)
|
||||
setFlights([])
|
||||
}
|
||||
})
|
||||
.finally(() => setIsLoading(false))
|
||||
}, [origin, page]);
|
||||
|
||||
useEffect(() => {
|
||||
fetchData()
|
||||
}, [fetchData]);
|
||||
|
||||
return { flights, count, error, fetchData };
|
||||
return { flights, count, isLoading, error, fetchData };
|
||||
};
|
||||
|
|
|
@ -86,6 +86,14 @@ code {
|
|||
|
||||
.Items {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(80px, 250px));
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.form-error {
|
||||
background-color: #ffdddd;
|
||||
color: #d8000c;
|
||||
border: 1px solid #d8000c;
|
||||
padding: 15px;
|
||||
margin-bottom: 15px;
|
||||
border-radius: 4px;
|
||||
}
|
|
@ -85,10 +85,19 @@ export function AuthProvider({
|
|||
setToken(x.access_token)
|
||||
navigate("/home")
|
||||
})
|
||||
.catch((error) => setError(error))
|
||||
.catch((error) => {
|
||||
try {
|
||||
setError(JSON.parse(error.response.data)["detail"] as string);
|
||||
} catch {}
|
||||
})
|
||||
.finally(() => setLoading(false));
|
||||
})
|
||||
.catch((error) => setError(error))
|
||||
.catch((error) => {
|
||||
setLoading(false)
|
||||
try {
|
||||
setError(JSON.parse(error.response.data)["detail"] as string);
|
||||
} catch {}
|
||||
})
|
||||
// .finally(() => setLoading(false));
|
||||
}
|
||||
|
||||
|
|
|
@ -60,17 +60,21 @@ def get_flight_by_id(db: Session, flight_id: int):
|
|||
return db.query(Flight).filter(Flight.id == flight_id).first()
|
||||
|
||||
|
||||
def get_flights(db: Session, page: int = 1, limit: int = 8):
|
||||
def get_flights(db: Session, deleted, page: int = 1, limit: int = 8):
|
||||
if page <= 0:
|
||||
page = 1
|
||||
skip = (page - 1) * limit
|
||||
count = db.query(Flight).count()
|
||||
return db.query(Flight).offset(skip).limit(limit).all(), count
|
||||
condition = Flight.status != "Deleted" if not deleted else True
|
||||
count = db.query(Flight).filter(condition).count()
|
||||
return db.query(Flight).filter(condition).offset(skip).limit(limit).all(), count
|
||||
|
||||
|
||||
def create_flight(db: Session, flight: FlightPydantic):
|
||||
if not is_flight_unique(db, flight):
|
||||
raise ValueError
|
||||
raise ValueError("non-unique")
|
||||
|
||||
if is_flight_collision(db, flight):
|
||||
raise ValueError("collision")
|
||||
|
||||
db_flight = Flight(
|
||||
flight_code=flight.flight_code,
|
||||
|
|
|
@ -32,8 +32,12 @@ def get_flight_by_id(id: int, db: Session = Depends(get_db)):
|
|||
def create_flight(flight: FlightCreate, db: Session = Depends(get_db)):
|
||||
try:
|
||||
return flight_crud.create_flight(db=db, flight=flight)
|
||||
except ValueError:
|
||||
except ValueError as e:
|
||||
msg = str(e)
|
||||
if msg == "non-unique":
|
||||
raise HTTPException(status_code=409, detail="Flight already exists")
|
||||
elif msg == "collision":
|
||||
raise HTTPException(status_code=409, detail="Flight collision")
|
||||
|
||||
|
||||
@router.patch("/{id}", response_model=Flight)
|
||||
|
@ -80,6 +84,7 @@ def get_flights(
|
|||
destination: Optional[str] = None,
|
||||
lastUpdated: Optional[str] = None,
|
||||
future: Optional[str] = None,
|
||||
deleted: Optional[str] = None,
|
||||
page: Optional[int] = 1,
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
|
@ -96,7 +101,7 @@ def get_flights(
|
|||
db=db, destination=destination, future=future
|
||||
)
|
||||
else:
|
||||
flights, count = flight_crud.get_flights(db=db, page=page)
|
||||
flights, count = flight_crud.get_flights(db=db, page=page, deleted=deleted)
|
||||
response.headers["X-Count"] = str(count)
|
||||
|
||||
if not flights:
|
||||
|
|
|
@ -30,7 +30,7 @@ app.add_middleware(
|
|||
"http://host.docker.internal:8000",
|
||||
"http://host.docker.internal:8001",
|
||||
"http://localhost:3000",
|
||||
"http://192.168.1.127:3000",
|
||||
"http://localhost:3001",
|
||||
],
|
||||
allow_credentials=True,
|
||||
allow_methods=["POST", "GET", "PUT", "DELETE", "OPTIONS", "PATCH"],
|
||||
|
|
|
@ -18,7 +18,7 @@ async def login(user: UserLogin, req: Request):
|
|||
f"{API_AUTH}/login", "POST", json=user.model_dump(), headers=header
|
||||
)
|
||||
if status < 200 or status > 204:
|
||||
raise HTTPException(status_code=status, detail=response)
|
||||
raise HTTPException(status_code=status, detail=response["message"])
|
||||
return response
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ async def refresh(token: RefreshToken, req: Request):
|
|||
f"{API_AUTH}/refresh", "POST", json=token.model_dump(), headers=header
|
||||
)
|
||||
if status < 200 or status > 204:
|
||||
raise HTTPException(status_code=status, detail=response)
|
||||
raise HTTPException(status_code=status, detail=response["message"])
|
||||
return response
|
||||
|
||||
|
||||
|
@ -43,7 +43,7 @@ async def status(req: Request, authorization: Annotated[str | None, Header()] =
|
|||
}
|
||||
(response, status, _) = await request(f"{API_AUTH}/status", "GET", headers=header)
|
||||
if status < 200 or status > 204:
|
||||
raise HTTPException(status_code=status, detail=response)
|
||||
raise HTTPException(status_code=status, detail=response["message"])
|
||||
return response
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ async def get_flight_by_id(
|
|||
header = {"x-api-request-id": request_id}
|
||||
(response, status, _) = await request(f"{API_FLIGHTS}/{id}", "GET", headers=header)
|
||||
if status < 200 or status > 204:
|
||||
raise HTTPException(status_code=status, detail=response)
|
||||
raise HTTPException(status_code=status, detail=response["detail"])
|
||||
return response
|
||||
|
||||
|
||||
|
@ -38,7 +38,7 @@ async def create_flight(
|
|||
f"{API_FLIGHTS}", "POST", json=flight_data, headers=header
|
||||
)
|
||||
if status < 200 or status > 204:
|
||||
raise HTTPException(status_code=status, detail=response)
|
||||
raise HTTPException(status_code=status, detail=response["detail"])
|
||||
return response
|
||||
|
||||
|
||||
|
@ -58,7 +58,7 @@ async def update_flight(
|
|||
f"{API_FLIGHTS}/{id}", "PATCH", json=update, headers=header
|
||||
)
|
||||
if status < 200 or status > 204:
|
||||
raise HTTPException(status_code=status, detail=response)
|
||||
raise HTTPException(status_code=status, detail=response["detail"])
|
||||
return response
|
||||
|
||||
|
||||
|
@ -69,6 +69,7 @@ async def get_flights(
|
|||
origin: Optional[str] = None,
|
||||
destination: Optional[str] = None,
|
||||
lastUpdated: Optional[str] = None,
|
||||
deleted: Optional[str] = None,
|
||||
page: Optional[int] = 1,
|
||||
future: Optional[str] = None,
|
||||
):
|
||||
|
@ -81,6 +82,8 @@ async def get_flights(
|
|||
query["lastUpdated"] = lastUpdated
|
||||
if future:
|
||||
query["future"] = future
|
||||
if deleted:
|
||||
query["deleted"] = deleted
|
||||
if page:
|
||||
query["page"] = page
|
||||
request_id = req.state.request_id
|
||||
|
@ -89,7 +92,7 @@ async def get_flights(
|
|||
f"{API_FLIGHTS}", "GET", query=query, headers=header
|
||||
)
|
||||
if status < 200 or status > 204:
|
||||
raise HTTPException(status_code=status, detail=response)
|
||||
raise HTTPException(status_code=status, detail=response["detail"])
|
||||
if "x-count" in headers:
|
||||
res.headers["x-count"] = headers["x-count"]
|
||||
return response
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
import logging
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
my_logger = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("", status_code=200)
|
||||
async def get_health():
|
||||
my_logger.info('{"health":"OK"}')
|
||||
return {"status": "OK"}
|
||||
|
|
|
@ -19,7 +19,7 @@ async def receive_message(message: Message, req: Request):
|
|||
f"{API_NOTIFICATIONS}", "POST", json=message.model_dump(), headers=header
|
||||
)
|
||||
if status < 200 or status > 204:
|
||||
raise HTTPException(status_code=status, detail=response)
|
||||
raise HTTPException(status_code=status, detail=response["detail"])
|
||||
return response
|
||||
|
||||
|
||||
|
@ -38,5 +38,5 @@ async def get_chat_by_user_id(
|
|||
f"{API_NOTIFICATIONS}", "GET", query=query, headers=header
|
||||
)
|
||||
if status < 200 or status > 204:
|
||||
raise HTTPException(status_code=status, detail=response)
|
||||
raise HTTPException(status_code=status, detail=response["detail"])
|
||||
return response
|
||||
|
|
|
@ -23,7 +23,7 @@ async def create_subscription(
|
|||
f"{API_SUBSCRIPTIONS}", "POST", json=subscription.model_dump(), headers=header
|
||||
)
|
||||
if status < 200 or status > 204:
|
||||
raise HTTPException(status_code=status, detail=response)
|
||||
raise HTTPException(status_code=status, detail=response["detail"])
|
||||
return response
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ async def delete_subscription(
|
|||
f"{API_SUBSCRIPTIONS}", "DELETE", json=subscription.model_dump(), headers=header
|
||||
)
|
||||
if status < 200 or status > 204:
|
||||
raise HTTPException(status_code=status, detail=response)
|
||||
raise HTTPException(status_code=status, detail=response["detail"])
|
||||
return response
|
||||
|
||||
|
||||
|
@ -62,5 +62,5 @@ async def get_subscriptions(
|
|||
f"{API_SUBSCRIPTIONS}", "GET", query=query, headers=header
|
||||
)
|
||||
if status < 200 or status > 204:
|
||||
raise HTTPException(status_code=status, detail=response)
|
||||
raise HTTPException(status_code=status, detail=response["detail"])
|
||||
return response
|
||||
|
|
|
@ -18,7 +18,7 @@ async def create_users(user: UserRegister, req: Request):
|
|||
f"{API_USERS}", "POST", json=user.model_dump(), headers=header
|
||||
)
|
||||
if status < 200 or status > 204:
|
||||
raise HTTPException(status_code=status, detail=response)
|
||||
raise HTTPException(status_code=status, detail=response["message"])
|
||||
return response
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@ async def create_airline(
|
|||
f"{API_USERS}", "POST", json=data, headers=header
|
||||
)
|
||||
if status < 200 or status > 204:
|
||||
raise HTTPException(status_code=status, detail=response)
|
||||
raise HTTPException(status_code=status, detail=response["message"])
|
||||
return response
|
||||
|
||||
|
||||
|
@ -50,7 +50,7 @@ async def get_user(
|
|||
header = {"x-api-request-id": request_id}
|
||||
(response, status, _) = await request(f"{API_USERS}/{id}", "GET", headers=header)
|
||||
if status < 200 or status > 204:
|
||||
raise HTTPException(status_code=status, detail=response)
|
||||
raise HTTPException(status_code=status, detail=response["message"])
|
||||
return response
|
||||
|
||||
|
||||
|
@ -68,7 +68,7 @@ async def update_user(
|
|||
f"{API_USERS}/{id}", "PUT", json=user.model_dump(), headers=header
|
||||
)
|
||||
if status < 200 or status > 204:
|
||||
raise HTTPException(status_code=status, detail=response)
|
||||
raise HTTPException(status_code=status, detail=response["message"])
|
||||
return response
|
||||
|
||||
|
||||
|
@ -81,5 +81,5 @@ async def delete_user(
|
|||
header = {"x-api-request-id": request_id}
|
||||
(response, status, _) = await request(f"{API_USERS}/{id}", "DELETE", headers=header)
|
||||
if status < 200 or status > 204:
|
||||
raise HTTPException(status_code=status, detail=response)
|
||||
raise HTTPException(status_code=status, detail=response["message"])
|
||||
return response
|
||||
|
|
|
@ -37,7 +37,6 @@ export const Arrival: React.FC<Props> = (props) => {
|
|||
<Th>Code</Th>
|
||||
<Th>Origin</Th>
|
||||
<Th>Time</Th>
|
||||
<Th>Gate</Th>
|
||||
<Th>Status</Th>
|
||||
</Tr>
|
||||
</Thead>
|
||||
|
|
Loading…
Reference in New Issue