it will caliculate time gap bewtween each request
if it is request cross greater thatn 10 minutes
its logout
axios.interceptors.request.use(function (request) { const d = new Date(); let current_time =d.getTime(); let api_request_timeout = (60000)*(globalVariables.api_request_timeout); let timeout = current_time - parseInt(globalVariables.last_request_time_stamp); if (api_request_timeout <= timeout){ router.push({ name: "logout" }).catch(() => {}); } globalVariables.last_request_time_stamp =current_time; return request; } );)
No comments:
Post a Comment