diff --git a/api/app/Http/Controllers/GameController.php b/api/app/Http/Controllers/GameController.php index bc04482..15061f8 100644 --- a/api/app/Http/Controllers/GameController.php +++ b/api/app/Http/Controllers/GameController.php @@ -30,7 +30,11 @@ class GameController extends Controller $query->where("status", $request->status); } - $query->orderBy("began_at", "desc"); + if ($request->has("sort_direction") && in_array($request->sort_direction, ["asc", "desc"])) { + $query->orderBy("began_at", $request->sort_direction); + }else{ + $query->orderBy("began_at", "desc"); + } return response()->json($query->paginate(15)); } diff --git a/frontend/src/components/layout/NavBar.vue b/frontend/src/components/layout/NavBar.vue index b605b46..015f987 100644 --- a/frontend/src/components/layout/NavBar.vue +++ b/frontend/src/components/layout/NavBar.vue @@ -15,13 +15,13 @@ - + Login - + Logout @@ -36,7 +36,6 @@ - +