mirror of https://github.com/pixelfed/pixelfed.git
Update BaseApiController
This commit is contained in:
parent
ec18c80c13
commit
5ef7936b48
|
@ -59,14 +59,11 @@ class BaseApiController extends Controller
|
||||||
$res = $this->fractal->createData($resource)->toArray();
|
$res = $this->fractal->createData($resource)->toArray();
|
||||||
} else {
|
} else {
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'page' => 'nullable|integer|min:1',
|
'page' => 'nullable|integer|min:1|max:10',
|
||||||
'limit' => 'nullable|integer|min:1|max:10'
|
'limit' => 'nullable|integer|min:1|max:10'
|
||||||
]);
|
]);
|
||||||
$limit = $request->input('limit') ?? 10;
|
$limit = $request->input('limit') ?? 10;
|
||||||
$page = $request->input('page') ?? 1;
|
$page = $request->input('page') ?? 1;
|
||||||
if($page > 3) {
|
|
||||||
return response()->json([]);
|
|
||||||
}
|
|
||||||
$end = (int) $page * $limit;
|
$end = (int) $page * $limit;
|
||||||
$start = (int) $end - $limit;
|
$start = (int) $end - $limit;
|
||||||
$res = NotificationService::get($pid, $start, $end);
|
$res = NotificationService::get($pid, $start, $end);
|
||||||
|
|
Loading…
Reference in New Issue