Laravel Backends for Vue.js 3 and Nuxt

Create your account and start learning

This lesson is free, but requires you to login.

or

Register Users with Laravel Fortify for a Vue.js SPA

In this lesson, we start adding the Vue.js code to get the registration page working. This requires making an ajax request to the /api/register route provided by the Laravel backend.

We also need to ensure we have the CSRF token set as a cookie. You can do this once on load, by making a request to /sanctum/csrf-cookie.

We also setup axios to include cookies in the ajax requests with the withCredentials option.

📝 NOTE: if you'd prefer to use Nuxt's built in $fetch function instead of axios we've added a new video to the end of the course that shows you how

Links