Anybody knows how can I send a custom flash message after a success action? Thanks!
Ex:
* show(request, response) {
let user = checkCrendetials('user', '12345')
if(!user) {
response.redirect('back')
return
}
//Flash message here
response.redirect('panel')
}
Try something like that :
Controller :
yield request.with({flash: {type: 'success', message: 'My wounderful success message'}}).flash()
response.redirect('panel')
View :
{% for item in old('flash') %}
<li class="message-{{ item.type }}"> {{ item.message }} </li>
{% endfor %}
And read the doc : http://adonisjs.com/docs/3.2/sessions#_basic_usage_of_flash_messages ;)
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Try something like that :
Controller :
yield request.with({flash: {type: 'success', message: 'My wounderful success message'}}).flash()response.redirect('panel')View :
{% for item in old('flash') %}<li class="message-{{ item.type }}"> {{ item.message }} </li>{% endfor %}And read the doc : http://adonisjs.com/docs/3.2/sessions#_basic_usage_of_flash_messages ;)