The problem of axios fetching data in vue

Business scenario:
the problem of getting token when you click to log in. After logging in with token, load the dictionary coding table (token is required when loading the codemark table)

how to write the interceptor
main.js

clipboard.png


debuggertokennullifelse ifeae007debugger~~

:login_axiosselect_code_axios

clipboard.png
is there any problem with my writing like this? how can I improve it? And why debugging no matter what the value of eae007 will enter the judgment of if, but the condition is that false will also enter debugger.

Apr.02,2021

is it because your login and your loading dictionary coding table are executed at the same time? can you use async/await to load the dictionary encoder after login is completed? Log in to the first API you request. The token in the interceptor is null. Only if you log in successfully will the API return token, and you will put it in the sessionStorage.

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-1ead0c8-4f5f5.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-1ead0c8-4f5f5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?