Apr 8, 2022
0
Level 3
Flash session disappears only after second reload
Maybe it's something simple, but I can't understand why my session only disappears after the second page reload. See how I'm doing it:
Component Vuejs:
export default {
props: ['uploadfim'],
},
data(){
return {
}
},
methods: {
enviado() {
axios.post('/upload-success', {
})
.then(response => {
location.reload();
})
.catch( error => {
});
},
}
My Blade:
<pet-media uploadfim="{{ session()->has('upload_fim') }}" ></pet-media>
My controler (upload-success):
public function uploadSuccess(Request $request)
{
session(['upload_success' => 'Anvio feito com sucesso!']);
}
My Controler show page:
public function petMedia(Request $request, $petid)
{
$uploadfim = session('upload_success');
if ($uploadfim) {
session()->forget('upload_success');
session()->flash('upload_fim', $uploadfim);
}
return view('auth.pet-media');
}
I can't understand why it doesn't work. I need to do 2 reloads to disappear the session. I tried in another browser and in the anonymous tab, but the same thing happens. What could I be doing wrong?
Please or to participate in this conversation.