The problem of page data request after Mini Program's authorization

clipboard.png
1. Discovery, shopping cart, my page all require the user to log in before requesting data, if there is no login to display the authorization button.

2. My three pages all set whether to display the login button by setting hasLogin:app.globalData in data. For example, after I click on the authorized login on the discovery page,
I change the value in app.globalData, but the data of the other two pages are not updated. I need to use setData to update the hasLogin of their two pages, and I re-determine whether to log in in the onShow of these three pages. Then go to the value of setData hasLogin, but it doesn"t feel good to do so. How can I update it?

3. Generally speaking, I go to onLoad to request background data, but without authorization, I should not make a request to enter Discovery, Shopping cart, or my page. The request in the onLoad will not take effect until the user is authorized to log in before the request can be initiated. If I am authorized in the discovery page, in the event of authorization, I can only trigger a data re-request for the discovery page. How can I initiate a request in a page where the onload of other initialized pages is no longer executed after clicking authorization on one page?

also ask the bosses to give us some advice, thank you!


since it is a global variable, it can be used directly. Judge whether you meet the requirements in onLoad, request data if you do, and let the user authorize if you don't. There is no need to assign values in each data

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