In the front-end separation project, what is the front-end and back-end responsible for user interception?

Douyin has just been installed. Users who do not log in can watch the content.

you will be prompted to log in directly when you only click like, double click like, comment and other functions.

whether the interception was done in the foreground or in the background;

or both foreground and backstage,

what is the division of labor if both the foreground and the backstage are done?

the front end determines whether there is a token, without token and directly jumps to the front end to log in

is there a token, at the front end that needs to send data to the background? Or directly like the operation, and then determine whether the token is valid at the backend. If it is valid, the like is successful, and if the token is invalid, jump to the login page.

is it necessary for the front end to determine whether there is a token?

Apr.23,2021

both front and back ends have to be done. The purpose of the front end is whether it is easy to use (unless you don't care), to tell the user how to do it as soon as possible (there is no token to log in), the back end is the basis of this system.


how do you know if you are logged in without judging?

or maybe every time you like, you send a request and then the backend returns an unlogged status code. The front end can also get it according to the status code

.

frontend is more appropriate, but needs backend cooperation:
1) when the backend sends the data list to the frontend, bring the login status
2) when you click the like button to determine whether the status is logged in, if you log in, send the like to the backend through the API. If you haven't logged in, you can OK directly from the login page


    .
  1. both front and back ends should be done
  2. The
  3. front end is responsible for displaying messages to users. Most users simply use the product. You can intercept these users by judging their status at the front end
  4. the backend should also be checked to avoid some users deliberately bypassing the front-end check
  5. .
  6. the specific division of labor is related to the technical architecture of the product, and there are many solutions to be implemented. Choose
  7. according to your needs.

our project will judge whether a user can interact according to whether he has purchased a course. Probably, there should be a place where the user name will be displayed on the
page. After logging in, put the user ID there
1. When giving likes or other interactions, send the user ID to the background along with the like interface, so that the background can know which user is doing the operation
2. If you are not prompted to log in without the user ID, please log in
3 first. If you do not log in and send a like request for some reason, the request will fail because the upload does not have the required parameter of user ID, and there will be no error in the like data. The result of the request is 1, and the corresponding tips

will be popped up according to the failure message returned by the backend.

also does another processing: write two action buttons and use v-if to determine which one is displayed. When the user does not log in, the corresponding button does not bind the corresponding interactive function, but binds the tips prompt to log in; when the user logs in, the clickable action button is displayed.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37c4b-e60d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37c4b-e60d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?