Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

Typescript error on API post call


Am trying to do a post api call in a component but getting this error

Type '{ first_name: string; last_name: string; email: string; role: string; }' has no properties in common with type 'AxiosRequestConfig'

is this a bad way of doing it?

But if I do it through the store its ok, should i be doing all the api calls through the store?

issue is I need the API response on that component


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (2)


Hi George,

Thank you for contacting our support.

To fix the typescript issue you need to wrap your data with params.

{
params: {
// your data here
}
}


Mostly you need to use vuex store when you want to share your data between multiple components.

You can read more about vuex usage in official doc:

You can make API calls in the vuex module and then assign a response to the vuex state and after a state is set get the vuex state inside your component. See doc

Regards,
Lauris Stepanovs,
Keenthemes Support Team



Am using metronic 8.1.1 vue version


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(