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

Property 'access_token' does not exist on type 'AxiosResponse<any>'. #3066

Open
Mnigos opened this issue Jul 16, 2021 · 1 comment
Open

Property 'access_token' does not exist on type 'AxiosResponse<any>'. #3066

Mnigos opened this issue Jul 16, 2021 · 1 comment
Labels

Comments

@Mnigos
Copy link

Mnigos commented Jul 16, 2021

  • [✔️] I have searched through existing issues
  • [✔️] I have read through docs
  • [✔️] I have read FAQ
  • [✔️] I have tried restarting VS Code or running Vetur: Restart VLS

Info

  • Platform: Win
  • Vetur version: v.0.34.1
  • VS Code version: -

Problem

I got error when i try to get an property from AxiosResponse object.

.then((res: AxiosResponse) => {
  this.$store.state.token = res.access_token
  this.$router.push('/')
})

I checked it and it's normally displaying res.access_token in console and overriding the this.$store.state.token variable.

@yoyo930021
Copy link
Member

It's not a bug.
TypeScript can't know your response from API. So you only can get any.
PS. we use res.data in axios nomarlly.

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

No branches or pull requests

2 participants