Closed jakemake closed 3 years ago
Hi @jakemake It looks like you did everything right as far as I can tell (at least from the server's perspective). In fact I did something similar in my own app and it worked, although I'm using React instead of Vue.
Looking at the official docs for the Vue 2 adapter, I think you need to access flash messages this way:
{{ $page.props.flash.message }}
Let me know if it worked for you :-)
@eidellev thanks again for your quick reply )) Seems like it's a Vue watchers bug or something 🤷♂️. Works unstable, and hard to find out issue pattern. But i managed to use you suggestion with little tweaks and it works. Sorry for disturbing and thanks =)
Hi! I'm tryin to configure snackbar notifications using Adonisjs session flash, after creating new row through the POST method
I set session flash message then redirect to another path in adonis controller but my vue app can't see any changes in $page.props.[shared data name]
My adonisjs controller: "create" method:![image](https://user-images.githubusercontent.com/22964241/129788900-37df3697-ad68-4221-a186-ce903cef30d9.png)
"list" method:![image](https://user-images.githubusercontent.com/22964241/129791161-61ae3466-dfe3-4531-a6ec-ae753abd25bd.png)
In chrome dev tools network tab i can see server responds properly with shared data (with flash messages)![image](https://user-images.githubusercontent.com/22964241/129789574-0b9be5e8-1f08-451f-a306-c483f74d5e16.png)
Seems like inertia adapter or inertia self not updating $page variable
start/inertia.ts![image](https://user-images.githubusercontent.com/22964241/129789991-c900294e-1d66-42bc-ad8b-2837cccbc6b9.png)
i set watcher in Vue 2 like this (in layout component)
additionally i put console log to watcher and watcher's value staying changeless.
Also i tried to set preserveState but no result
But ihave several cases, where notifications works properly,
When i'm staying on same page for example "/admin/reservation/list" and trying to create new "reservation" using modal dialog