Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when login at frontend #2

Open
hiepvq opened this issue Oct 13, 2023 · 0 comments
Open

Error when login at frontend #2

hiepvq opened this issue Oct 13, 2023 · 0 comments

Comments

@hiepvq
Copy link

hiepvq commented Oct 13, 2023

Laravel need to verify every request with token

if user login to send request login to create token
D:\Projects\otickets\frontend\src\lib\axios.ts

import axios from 'axios'

const auth = JSON.parse(localStorage.getItem('auth') || '{}')

axios.defaults.baseURL = import.meta.env.VITE_API_URL_API

if (auth.token) {
  axios.defaults.headers.common['Authorization'] = 'Bearer ' + auth.token
}

export default axios

look at in code you can see auth.token variable is not existing
== > error
image

how to bypass this bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant