I receive error on catch TypeError: relativeURL.replace is not a function

See original GitHub issue

I try to save this data…

Object VM

Each property is transformed in getters and setters by Vue.js

save () {
let scheduleRequests = []
self.schedule.forEach(it => {
  scheduleRequests.push(self.saveEventSchedule({ // <-- VUEX ACTION
    title: it.title,
    tags: it.tags.map(it => it.id)
  }))
})

return axios.all(scheduleRequests)
  .then(results => {
    self.vm.schedule = results.map(r => r.id)
    return self.saveEvent(self.vm)   // <-- VUEX ACTION
      .then(resolve)
      .catch(reject)
  })
  .catch(reject)
}

In my actions …

saveEvent ({ commit }, event) {
  return events.post(event)
    .then(resp => {
      return resp.data
    })
    .then(resp => {
      commit(ADD_EVENT, resp)
      return resp
    })
}

saveEventSchedule ({ commit }, eventSchedule) {
  return eventSchedule.post(eventSchedule)
    .then(resp => {
      return resp.json()
    })
    .then(resp => {
      commit(ADD_EVENT_SCHEDULE, resp)
      return resp
    })
},

And I receive this in catch

axios

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
iVaporcommented, Dec 24, 2018

I meet this problem. Because I add parameter [method post] in axios.post function. Hope it helps someone.

3reactions
nickuraltsevcommented, Oct 12, 2016

If events and eventSchedule are axios instances, you need to pass the url as the first parameter:

axios.post('/foo', {
  bar: 123
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

relativeURL.replace is not a function error in Next.js
I believe this is caused by your use of axios and have nothing to do with Next.js. The method axios.get only takes string...
Read more >
I receive error on catch TypeError: relativeURL ... - Bountysource
I receive error on catch TypeError : relativeURL.replace is not a function.
Read more >
Uncaught TypeError | Is Not A Function | Solution - YouTube
Have you encountered an error like:- Uncaught TypeError - Some selector is not a function - jQuery is not a function - owlCarousel...
Read more >
Import Axios results in Uncaught SyntaxError: Invalid regular ...
I'm currently building a website where i'm using Laravel Mix to compile all my assets through Webpack. It's not a Laravel project, but...
Read more >
URL() - Web APIs - MDN Web Docs - Mozilla
If url is a relative URL, base is required, and will be used as the ... Raises a TypeError exception as '/en-US/docs' is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found