Guest User

Untitled

a guest
Aug 14th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. if (!route.path.startsWith('/login') && !route.path.startsWith('/assets') && route.path !== '/') {
  2. store.state.requestUrl = route.path
  3. }
  4.  
  5. if (!store.state.authenticated) {
  6. return redirect('/login')
  7. }
  8.  
  9. await this.$store.dispatch('login', {
  10. username: this.loginDetails.username,
  11. password: this.loginDetails.password
  12. })
  13. this.$router.push(this.$store.state.requestUrl) // this is always '/'
  14. } catch (e) {
  15. console.log(e)
  16. this.failedLogin = true
  17. }
Add Comment
Please, Sign In to add comment