- return $this->switchViewType($id, $request, 'books');
- }
-
- /**
- * Update the user's preferred shelf-list display setting.
- */
- public function switchShelvesView(Request $request, int $id)
- {
- return $this->switchViewType($id, $request, 'bookshelves');
- }
-
- /**
- * Update the user's preferred shelf-view book list display setting.
- */
- public function switchShelfView(Request $request, int $id)
- {
- return $this->switchViewType($id, $request, 'bookshelf');
- }
-
- /**
- * For a type of list, switch with stored view type for a user.
- */
- protected function switchViewType(int $userId, Request $request, string $listName)
- {
- $this->checkPermissionOrCurrentUser('users-manage', $userId);
+ $valueViewTypes = ['books', 'bookshelves', 'bookshelf'];
+ if (!in_array($type, $valueViewTypes)) {
+ return redirect()->back(500);
+ }