@tramvai/module-router 1.41.0 → 1.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -315,6 +315,37 @@ Such a route is specified in the list of routes with the special `*` character i
|
|
|
315
315
|
</details>
|
|
316
316
|
</p>
|
|
317
317
|
|
|
318
|
+
### How to change Not found route response status
|
|
319
|
+
|
|
320
|
+
By default, responses for the Not found route return a status of 200.
|
|
321
|
+
You can change status in custom Route Guard, by using `RESPONSE_MANAGER_TOKEN`.
|
|
322
|
+
|
|
323
|
+
<p>
|
|
324
|
+
<details>
|
|
325
|
+
<summary>An example of changing a Not Found route response status</summary>
|
|
326
|
+
|
|
327
|
+
@inline ../../../examples/how-to/router-not-found-custom-status/index.tsx
|
|
328
|
+
|
|
329
|
+
</details>
|
|
330
|
+
</p>
|
|
331
|
+
|
|
332
|
+
### How to change response status in actions
|
|
333
|
+
|
|
334
|
+
For example, you make a important request in action, and if this request will fail, application need to return 500 or 404 status.
|
|
335
|
+
|
|
336
|
+
Page actions running after router navigation flow, when route is completely resolved.
|
|
337
|
+
You can change status by using `RESPONSE_MANAGER_TOKEN`.
|
|
338
|
+
If you want to prevent page component rendering, you can throw `NotFoundError` from `@tinkoff/errors` library.
|
|
339
|
+
|
|
340
|
+
<p>
|
|
341
|
+
<details>
|
|
342
|
+
<summary>An example of changing response status in actions</summary>
|
|
343
|
+
|
|
344
|
+
@inline ../../../examples/how-to/router-action-error/index.tsx
|
|
345
|
+
|
|
346
|
+
</details>
|
|
347
|
+
</p>
|
|
348
|
+
|
|
318
349
|
### Testing
|
|
319
350
|
|
|
320
351
|
#### Testing ROUTER_GUARD_TOKEN extensions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-router",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.45.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"browser": {
|
|
@@ -25,22 +25,22 @@
|
|
|
25
25
|
"@tinkoff/errors": "0.2.18",
|
|
26
26
|
"@tinkoff/router": "0.1.64",
|
|
27
27
|
"@tinkoff/url": "0.7.37",
|
|
28
|
-
"@tramvai/tokens-render": "1.
|
|
29
|
-
"@tramvai/tokens-router": "1.
|
|
30
|
-
"@tramvai/tokens-server": "1.
|
|
31
|
-
"@tramvai/experiments": "1.
|
|
28
|
+
"@tramvai/tokens-render": "1.45.0",
|
|
29
|
+
"@tramvai/tokens-router": "1.45.0",
|
|
30
|
+
"@tramvai/tokens-server": "1.45.0",
|
|
31
|
+
"@tramvai/experiments": "1.45.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@tinkoff/utils": "^2.1.2",
|
|
35
|
-
"@tramvai/cli": "1.
|
|
36
|
-
"@tramvai/core": "1.
|
|
37
|
-
"@tramvai/module-log": "1.
|
|
38
|
-
"@tramvai/module-server": "1.
|
|
39
|
-
"@tramvai/papi": "1.
|
|
40
|
-
"@tramvai/state": "1.
|
|
41
|
-
"@tramvai/test-helpers": "1.
|
|
42
|
-
"@tramvai/test-mocks": "1.
|
|
43
|
-
"@tramvai/tokens-common": "1.
|
|
35
|
+
"@tramvai/cli": "1.45.0",
|
|
36
|
+
"@tramvai/core": "1.45.0",
|
|
37
|
+
"@tramvai/module-log": "1.45.0",
|
|
38
|
+
"@tramvai/module-server": "1.45.0",
|
|
39
|
+
"@tramvai/papi": "1.45.0",
|
|
40
|
+
"@tramvai/state": "1.45.0",
|
|
41
|
+
"@tramvai/test-helpers": "1.45.0",
|
|
42
|
+
"@tramvai/test-mocks": "1.45.0",
|
|
43
|
+
"@tramvai/tokens-common": "1.45.0",
|
|
44
44
|
"@tinkoff/dippy": "0.7.35",
|
|
45
45
|
"react": "*",
|
|
46
46
|
"tslib": "^2.0.3"
|