Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Register implementation

Premium
7 min read

In this lesson, we will learn how to work with Pinia to manage the state and values used for the form, and how to send a request to the server using the Axios library when a user submits the form and reads the response from the server.

First, we need to install the Axios library for requests to API:

npm install axios --save

Then create a new file src/bootstrap.js with the following content:...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (29 h 14 min)

You also get:

54 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

M
MattLab ✓ Link copied!

What is the point of using a "store"? To deport the logic of the registration process or to manage the form with the pending data? Couldn't we manage the form directly in the "register" component?

DL
David Lun ✓ Link copied!

Composition API allows to extract logic from components and reuse it across multiple components, which can improve the readability and maintainability of the code.

Of couse we can manage logic directly in register component without much of a side effects, but the goal was to show how to apply Composition API logic. This can be particularly useful in large applications, where it is common to have multiple components that need to share the same functionality.

In addition applying this pattern it helps to organize your code.

M
MattLab ✓ Link copied!

Thanks David ;)

MM
Md Mahmudul Hasan ✓ Link copied!

Guys who is getting an error from the laravel project regarding 'CORS'. Just edit config/cors.php... set allowed_origin = vuejs domain and supports_credentials=true

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.