Skip to content

Commit

Permalink
Merge pull request #47 from eurofurence/bugfix/13-Redirect_with_no_shift
Browse files Browse the repository at this point in the history
Bugfix #13 - fix the back button
  • Loading branch information
Corborax authored Sep 8, 2024
2 parents 7459b2e + 6d0d2a9 commit c903ff7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions includes/pages/user_shifts.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,14 @@ function load_days()
->toArray();

if (empty($days)) {
error(__('The administration has not configured any shifts yet.'));
// Do not try to redirect to the current page
if (config('home_site') != 'user_shifts') {
throw_redirect(url('/'));
if (auth()->can('admin_shifts')) {
throw_redirect(url('/admin-shifts'));
} else {
error(__('The administration has not configured any shifts yet.'));
// Do not try to redirect to the current page
if (config('home_site') != 'user_shifts') {
throw_redirect(url('/'));
}
}
}
return $days;
Expand Down

0 comments on commit c903ff7

Please sign in to comment.