M
M
mShpakov2018-11-12 14:35:48
API
mShpakov, 2018-11-12 14:35:48

Is it normal to return a redirect in api?

Dispute and therefore two opinions. Interested in outside opinion on this.
Situation:
The application is divided into backend (api) and frontend (independently lives as a separate project on vue and uses axios for requests). The application has sides closed by authorization.
1 opinion: if, being not authorized, I open /orders on the front, the client will send a request to the server, to which it should respond with 401 (not authorized) and then the client decides that it is necessary to redirect to /login (or, for example, simply show window with an error, like you are not authorized). Or millions more options, the main thing is that the front receives 401 from the server and decides what to do.
2nd opinion: the server should return a redirect

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2018-11-12
@zkelo

1 option

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question