Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

douglas_quaid's avatar

Uncaught TypeError: Cannot read property 'get' of undefined

Hi,

very new to Laravel Spark here. I downloaded the sample Code with Tasks & Activity from Spark Demo. I know this demo was done on an older version of Laravel, so I decided to manually move over some of Tasks & activities models, controllers, views over to a fresh install with updated version of Laravel.

Here is the problem:

On the home page route, I'm getting the following error

Uncaught TypeError: Cannot read property 'get' of undefined at VueComponent.getTasks (app.js:28681)

I believe the error is referring to the following code in Home.js file

getTasks() { this.$http.get('/api/tasks') .then(response => { this.tasks = response.data; }); },

I'm not sure why it's saying this is undefined... when I hit /api/tasks in the browser it returns the json object of tasks correctly. What exactly is the problem here? Am I missing some files?

0 likes
3 replies
douglas_quaid's avatar

Yes! Thank you @Nick385 I just noticed this as well that the Spark Demo ships with vue-resource as a dependency and not Axios, so the calls are different

axios.get

vs.

this.$http

Cheers!

Please or to participate in this conversation.