i can access the Session::get('LoggedUser')
on the index function with no problem.
but i can't access the session when i send an axios post request to the getProjects() function.
Controller code:
class ProjectController extends Controller
{
public function index(){
//dd(Session::get('LoggedUser'));
return view('user.project.dashboard');
}
public function getProjects(){
dd(Session::get('LoggedUser'));
}
}
compnent code:
mounted(){
axios.post('/api/user/projects')
.then(response=>{
console.log(response.data.data)
})
}
api.php:
Route::prefix('user')->group(function(){
Route::post('projects',[UserProjectController::class, 'getProjects']);
});
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/39DISuk
via IFTTT
Aucun commentaire:
Enregistrer un commentaire