Refactor all JS API calls #360 (#375)

* Refactor all JS API calls #360

* Remove unused imports

* Lint JS

* Fix doubled api key

* Formatting

* Added extra logging to distance lookup

* Remove the .editorconfig file in distrib

* shell check fixes

* Remove the .editorconfig file in distrib
This commit is contained in:
Nabeel S
2019-08-30 08:08:00 -04:00
committed by GitHub
parent e62e4a865d
commit 0d1f38cf85
39 changed files with 1397 additions and 745 deletions

View File

@@ -181,6 +181,7 @@ class PirepController extends Controller
Log::info('aircraft', $aircraft->toArray());
return view('admin.pireps.fares', [
'pirep' => null,
'aircraft' => $aircraft,
'read_only' => false,
]);

View File

@@ -73,8 +73,8 @@ class AcarsController extends Controller
$pireps = $this->acarsRepo->getPositions(setting('acars.live_time'));
$positions = $this->geoSvc->getFeatureForLiveFlights($pireps);
return response(json_encode($positions), 200, [
'Content-type' => 'application/json',
return response()->json([
'data' => $positions,
]);
}
@@ -84,15 +84,15 @@ class AcarsController extends Controller
* @param $pirep_id
* @param Request $request
*
* @return \Illuminate\Contracts\Routing\ResponseFactory
* @return \Illuminate\Http\JsonResponse
*/
public function acars_geojson($pirep_id, Request $request)
{
$pirep = Pirep::find($pirep_id);
$geodata = $this->geoSvc->getFeatureFromAcars($pirep);
return response(\json_encode($geodata), 200, [
'Content-Type' => 'application/json',
return response()->json([
'data' => $geodata,
]);
}

View File

@@ -505,6 +505,7 @@ class PirepController extends Controller
public function route_get($id, Request $request)
{
$pirep = Pirep::find($id);
return AcarsRouteResource::collection(Acars::where([
'pirep_id' => $id,
'type' => AcarsType::ROUTE,