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

Api post request - AxiosRespone mu have a Symbol.Iterator


Hi Lauris,
Metronic Vue 8.1.7
when using e.g. post request

const getUsers = () => {
ApiService.get("account/list")
.then((data) => {
tableData.value.splice(0, tableData.value.length, ...data);
})
.catch(({ response }) => {
console.log("API Request went wrong.");
});
};

I'm getting
Type 'AxiosResponse<any, any>' must have a '[Symbol.iterator]()' method that returns an iterator.

How can I get rid off this error?


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)


I figured it out,

tableData.value.splice(0, tableData.value.length, ...data.data);


hmmm is there something changed .... on 8.1.4 this worked like

tableData.value.splice(0, tableData.value.length, ...data);



Hi Krystian,

Sorry for the late reply.

Glad to hear you have already figured this out. In Metronic 8.1.7 release we haven't modified ApiService.ts this might be related to your server response changes.

Regards,
Lauris Stepanovs,
Keenthemes Support Team


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  :(