Answer the question
In order to leave comments, you need to log in
How to implement the correct data transfer from Component.vue to the session?
The essence of the task: there is a project on laravel + vue.js. Component.vue has a datepicker. Each time the datapicker changes, the date needs to be passed to the server. Then write it to the session. And return the session value back to Component.vue. The value from the session is necessary to use the selected date on other pages of the project, after which, returning to the page with Component.vue, its value should remain the same as it was set by the user even after switching to other pages. The problem is that periodically the session does not return the correct date. For example, we select 21 numbers, then 22, and the session returns 21. And this only happens sometimes. The probability of returning an incorrect date is about 1 in 10-15 transitions. The session is logged as follows
Public function setDate($date)
{
$request->session()->put('date',$date);
$request-session()-save();
Return json_encode($request-session()-get('date');
}
Answer the question
In order to leave comments, you need to log in
I would venture to suggest that the problem with the date occurs due to the time zone.
But for your needs it is not necessary to store the date on the server, you can use vuex or Cookies to write and store this data on the client.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question