How to write a statement in laravel to determine the expiration of a logged-in user's session?
PHP中文网
PHP中文网 2017-07-04 13:45:48
0
1
830

How to write a statement in laravel to determine the expiration of a logged-in user's session?

There is an ajax request that can return data when the user logs in. When the session expires, it will jump to the login page. How to do this?

 axios.get('/admin/articles')
      .then(response=>{
          console.log(response.data);
      })
      .catch(error=>{
          console.log(error);
      });
PHP中文网
PHP中文网

认证0级讲师

reply all(1)
習慣沉默

Expired, will return 401 status code

By default, axios will throw 401 to error. You can handle the 401 status code in catch and jump to the login page.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!