Class UnauthorizedError
public
Extends:
AdapterError
Defined in:
../packages/adapter/src/error.js:232
Module:
@ember-data/adapter/error
A UnauthorizedError
equates to a HTTP 401 Unauthorized
response
status. It is used by an adapter to signal that a request to the external
API was rejected because authorization is required and has failed or has not
yet been provided.
An example use case would be to redirect the user to a login route if a request is unauthorized:
app/routes/application.js | |
1 2 3 4 5 |
import Route from ' /routing/route'; import { UnauthorizedError } from ' -data/adapter/error'; import { action } from ' /object'; export default class ApplicationRoute extends Route { |