@tramvai/module-router 1.44.4 → 1.44.5

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.
Files changed (2) hide show
  1. package/README.md +31 -0
  2. 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.44.4",
3
+ "version": "1.44.5",
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.44.4",
29
- "@tramvai/tokens-router": "1.44.4",
30
- "@tramvai/tokens-server": "1.44.4",
31
- "@tramvai/experiments": "1.44.4"
28
+ "@tramvai/tokens-render": "1.44.5",
29
+ "@tramvai/tokens-router": "1.44.5",
30
+ "@tramvai/tokens-server": "1.44.5",
31
+ "@tramvai/experiments": "1.44.5"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@tinkoff/utils": "^2.1.2",
35
- "@tramvai/cli": "1.44.4",
36
- "@tramvai/core": "1.44.4",
37
- "@tramvai/module-log": "1.44.4",
38
- "@tramvai/module-server": "1.44.4",
39
- "@tramvai/papi": "1.44.4",
40
- "@tramvai/state": "1.44.4",
41
- "@tramvai/test-helpers": "1.44.4",
42
- "@tramvai/test-mocks": "1.44.4",
43
- "@tramvai/tokens-common": "1.44.4",
35
+ "@tramvai/cli": "1.44.5",
36
+ "@tramvai/core": "1.44.5",
37
+ "@tramvai/module-log": "1.44.5",
38
+ "@tramvai/module-server": "1.44.5",
39
+ "@tramvai/papi": "1.44.5",
40
+ "@tramvai/state": "1.44.5",
41
+ "@tramvai/test-helpers": "1.44.5",
42
+ "@tramvai/test-mocks": "1.44.5",
43
+ "@tramvai/tokens-common": "1.44.5",
44
44
  "@tinkoff/dippy": "0.7.35",
45
45
  "react": "*",
46
46
  "tslib": "^2.0.3"