-
Form validation (login/index.vue)
- utils/validate.js —> validMobile
-
Call the API wrapped in API /user.js
- Get the axios instance from axios instance: utils/request.js
- Sets the base address from the environment variable
-
Collect the user’s parameters and pass them to the API in the previous step. (The data item name of the collected page is the same as that in the interface)
-
Add request header via request interceptor (add token, utils/request.js)
-
Proxy forwarding (vue.config.js)
-
The back-end server needs to be started and mongoDB needs to be started. The backend receives the request and returns the data
-
Handled by the response interceptor (utils/request.js)
- Determine whether the current operation succeeded and whether Axios reported an error
- Simplify the writing of valid data (unshell)
-
Get the result of the API call (login.vue)
-
Save token to vuex (store/modules/user.js)
-
Token persistence (utils/auth.js)