github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/ui/app/utils/notify-forbidden.js (about)

     1  // An error handler to provide to a promise catch to set a
     2  // forbidden flag on the route
     3  import codesForError from './codes-for-error';
     4  export default function notifyForbidden(route) {
     5    return error => {
     6      if (codesForError(error).includes('403')) {
     7        route.set('isForbidden', true);
     8      } else {
     9        throw error;
    10      }
    11    };
    12  }