File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ Feel free to contribute to the project by creating issues or pull requests.
23
23
* [ Backend] ( #backend )
24
24
- [ Features] ( #features )
25
25
* [ Shared data] ( #shared-data )
26
+ * [ Flash Messages] ( #flash-messages )
26
27
* [ Server-side rendering] ( #server-side-rendering )
27
28
* [ Vite helper] ( #vite-helper )
28
29
- [ Examples] ( #examples-1 )
@@ -181,6 +182,26 @@ app.AddInertiaSharedData(httpContext => new InertiaProps
181
182
});
182
183
```
183
184
185
+ ### Flash Messages
186
+
187
+ You can add flash messages to your responses using the ` Inertia.Back(url).WithFlash(...) ` method.
188
+
189
+ ``` csharp
190
+ [HttpDelete (" {id:int}" )]
191
+ public async Task < IActionResult > Destroy (int id )
192
+ {
193
+ /// find user
194
+
195
+ if (! user .IsAdmin )
196
+ return Inertia .Back ().WithFlash (" error" , " Admins cannot be deleted." );
197
+
198
+ // delete user
199
+
200
+ return Inertia .Back ().WithFlash (" success" , " User deleted." );
201
+ }
202
+ ```
203
+
204
+
184
205
### Server-side rendering
185
206
186
207
If you want to enable SSR in your Inertia app, remember to add ` Inertia.Head() ` to your layout:
You can’t perform that action at this time.
0 commit comments