Website Portfolio with Laravel and Vue js | Login And Register Sanctum Auth With Vuejs 3
HTML-код
- Опубликовано: 30 сен 2024
- Today we are introducing a new series called “Let’s Build Portfolio Website” where we are mostly going to show you how we develop personal portfolio website based on Laravel and Vuejs from scratch
In this very second episode of “Let’s build Portfolio website”, we are going to see how to Login And Register Sanctum Auth With Vuejs 3.
Admin dashboard started kit : github.com/sha...
Front-end Portfolio Website : github.com/sha...
Just a tip, put on some background music at a low volume and don't talk too close to the microphone
Thanks you for suggestion ❤
Anyone facing this error:
Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes.
While running the migration, you need to add this line in AppServiceProvider in boot function:
Schema::defaultStringLength(191);
Don't forget to import the namespace for Schema
when I make a request via post man on register endpoint, it returns a 500 response(Internal Server Error)
run command:
composer require laravel/sanctum
php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
Add this line to your Api.php
Route::group([
'namespace' => 'App\Http\Controllers\Api',
], function ($router) {
Route::post('login', 'AuthController@login');
Route::post('register', 'AuthController@register');
Route::post('logout', 'AuthController@logout');
});
did not show in the video
give me the css for login page
router.beforeEach((to, from, next) => {
if (to.meta.requiresAuth && !localStorage.getItem('token')) {
next({ name: 'login' });
} else if (to.meta.requiresAuth === false && localStorage.getItem('token')) {
next({ name: 'admin' });
} else {
next(); // Continue with the navigation
}
});
Thanks ,