Update Route Controller to ensure that response is valid before parsin

This commit is contained in:
Luke Else 2022-02-09 20:22:46 +00:00
parent b6e5f09c11
commit c3a414285a

View File

@ -170,10 +170,16 @@ namespace EFB.Controllers
{ {
//Get Response from Charts //Get Response from Charts
ResponseModel<ChartResponse> responseDepartureCharts = await requestDepartureCharts; ResponseModel<ChartResponse> responseDepartureCharts = await requestDepartureCharts;
if (responseDepartureCharts.Error == null && responseDepartureCharts.Result.Status == "success")
{
user.DepartureCharts = new ChartModel(responseDepartureCharts.Result.Response); user.DepartureCharts = new ChartModel(responseDepartureCharts.Result.Response);
}
ResponseModel<ChartResponse> responseArrivalCharts = await requestArrivalCharts; ResponseModel<ChartResponse> responseArrivalCharts = await requestArrivalCharts;
if (responseArrivalCharts.Error == null && responseArrivalCharts.Result.Status == "success")
{
user.ArrivalCharts = new ChartModel(responseArrivalCharts.Result.Response); user.ArrivalCharts = new ChartModel(responseArrivalCharts.Result.Response);
}
//fill in route //fill in route
string finalRoute = RouteModel.ParseRoute(routeString); string finalRoute = RouteModel.ParseRoute(routeString);