2021年8月18日 星期三

javascript 透過 async 和 await 進行同步作業

async aaa() {
        let result=0;
await axios.post('./aaa')
.then(response => {
                        result=response.data;
}).catch(function (error) {
console.log(error);
});     
        consloe.log(result); // 等待 post 完成後才會執行
}

沒有留言:

自訂權限驗證機制

// 使用 filter [Route("api/[controller]")] [ApiController] [Authorize] [TypeFilter(typeof(CustomAsyncAuthorizationFilter))] public c...