coderstape/freeCodeGram

Internal server error

Opened this issue · 3 comments

POST http://127.0.0.1:8000/follow/2 500 (Internal Server Error)

i have this error when i try to

`methods: {
followUser() {
axios
.post("/follow/" + this.userId)
.then((response) => {
this.status = !this.status;

                console.log(response.data);
            })
            .catch((errors) => {
                if (errors.response.status == 401) {
                    window.location = "/login";
                }
            });
    },
},`

i think i have a problem with axios

I am having the same issue. Did you ever find a resolution to this?

 <follow-button user-id="{{ $user->id }}" follows="{{ $follows }}" v-show="{{ $user->id !== $profile->id }}"></follow-button>

methods: {
followUser() {
axios
.post("/follow/" + this.userId)
.then(response => {
this.status = !this.status;
console.log(response.data);
})
.catch(errors => {
if (errors.response.status == 401) {
window.location = "/login";
}
});
}
},

Doing the following fixed the issue for me:

Make sure to include this in the top of your FollowsController.php.

use App\Models\User;