Easily add support for the server protocol expected by Unpoly.
node ace add @jrmc/adonis-unpoly
Or
npm install @jrmc/adonis-unpoly
node ace configure @jrmc/adonis-unpoly
Sample close drawer or redirect
async store({ response, i18n, up }: HttpContext) {
// ...
session.flash('notification', {
type: 'success',
message: i18n.formatMessage('form.success.user.create'),
})
if (up.isDrawer()) {
up.setDismissLayer()
} else {
response.redirect().toRoute('admin.users.index')
}
}
Sample back button
@if(up.isDrawer())
<button up-dismiss>
@svg('tabler:arrow-left')
<button>
@else
<a href="{{ $props.href }}">
@svg('tabler:arrow-left')
</a>
@end