Skip to content

Commit f7daa82

Browse files
committed
feat: do not flash input data for Inertia requests
1 parent e6a4789 commit f7daa82

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/errors.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ export const E_BAD_CSRF_TOKEN = class InvalidCSRFToken extends Exception {
3232
}
3333

3434
async handle(error: this, ctx: HttpContext) {
35-
ctx.session.flashExcept(['_csrf', '_method', 'password', 'password_confirmation'])
35+
if (!ctx.request.header('X-Inertia')) {
36+
ctx.session.flashExcept(['_csrf', '_method', 'password', 'password_confirmation'])
37+
}
38+
3639
ctx.session.flashErrors({
3740
[error.code]: this.getResponseMessage(error, ctx),
3841
})

0 commit comments

Comments
 (0)