// token
async getLocalAccessToken() {
const token = await fs.readFile("wechatToken. txt", "utf8", (err, data) => {
return token;
});
return token;
}
// accesstoken
async updateMenu() {
// const access_token = await this.ctx.service.home.getLocalAccessToken();
}
I want to call getLocalAccessToken in the updateMenu function to get the value of token. I know it is wrong to write this way. If I call it asynchronously, I will execute return token; first. How do I write it?