Skip to content

Commit aadce4f

Browse files
committed
Docs: mark errors prop required in the protocol
inertiajs/inertiajs.com#369
1 parent c6da0c3 commit aadce4f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/guide/the-protocol.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Content-Type: text/html; charset=utf-8
2626
</head>
2727
<body>
2828
29-
<div id="app" data-page='{"component":"Event","props":{"event":{"id":80,"title":"Birthday party","start_date":"2019-06-02","description":"Come out and celebrate Jonathan&apos;s 36th birthday party!"}},"url":"/events/80","version":"c32b8e4965f418ad16eaebba1d4e960f"}'></div>
29+
<div id="app" data-page='{"component":"Event","props":{"errors":{},"event":{"id":80,"title":"Birthday party","start_date":"2019-06-02","description":"Come out and celebrate Jonathan&apos;s 36th birthday party!"}},"url":"/events/80","version":"c32b8e4965f418ad16eaebba1d4e960f"}'></div>
3030
3131
</body>
3232
</html>
@@ -58,6 +58,7 @@ X-Inertia: true
5858
{
5959
"component": "Event",
6060
"props": {
61+
"errors": {},
6162
"event": {
6263
"id": 80,
6364
"title": "Birthday party",
@@ -77,7 +78,7 @@ X-Inertia: true
7778
Inertia shares data between the server and client via a page object. This object includes the necessary information required to render the page component, update the browser's history state, and track the site's asset version. The page object includes the following four properties:
7879

7980
1. `component`: The name of the JavaScript page component.
80-
2. `props`: The page props (data).
81+
2. `props`: The page props. Contains all of the page data along with an `errors` object (defaults to `{}` if there are no errors).
8182
3. `url`: The page URL.
8283
4. `version`: The current asset version.
8384
5. `encryptHistory`: Whether or not to encrypt the current page's history state.
@@ -141,7 +142,8 @@ Content-Type: application/json
141142
"props": {
142143
"auth": {...}, // NOT included
143144
"categories": [...], // NOT included
144-
"events": [...] // included
145+
"events": [...], // included
146+
"errors": {} // always included
145147
},
146148
"url": "/events/80",
147149
"version": "c32b8e4965f418ad16eaebba1d4e960f"

0 commit comments

Comments
 (0)