@orpc/react 1.0.0-beta.5 → 1.0.0-beta.6
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/dist/hooks/index.mjs +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +6 -6
package/dist/hooks/index.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { safe,
|
1
|
+
import { safe, createORPCErrorFromJson } from '@orpc/client';
|
2
2
|
import { intercept, toArray } from '@orpc/shared';
|
3
3
|
import { useState, useCallback, useMemo } from 'react';
|
4
4
|
|
@@ -36,7 +36,7 @@ function useServerAction(action, options = {}) {
|
|
36
36
|
{ input },
|
37
37
|
({ input: input2 }) => action(input2).then(([error, data]) => {
|
38
38
|
if (error) {
|
39
|
-
throw
|
39
|
+
throw createORPCErrorFromJson(error);
|
40
40
|
}
|
41
41
|
return data;
|
42
42
|
})
|
package/dist/index.mjs
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import { ORPCError } from '@orpc/client';
|
1
|
+
import { ORPCError, createORPCErrorFromJson } from '@orpc/client';
|
2
2
|
import { StandardBracketNotationSerializer } from '@orpc/openapi-client/standard';
|
3
3
|
import { createProcedureClient } from '@orpc/server';
|
4
4
|
import { onError, resolveMaybeOptionalOptions, toArray } from '@orpc/shared';
|
5
5
|
|
6
6
|
const orpcErrorToNextHttpFallbackInterceptor = onError((error) => {
|
7
7
|
if (error instanceof ORPCError && [401, 403, 404].includes(error.status)) {
|
8
|
-
const nextError =
|
8
|
+
const nextError = createORPCErrorFromJson(error.toJSON());
|
9
9
|
nextError.cause = error;
|
10
10
|
nextError.digest = `NEXT_HTTP_ERROR_FALLBACK;${error.status}`;
|
11
11
|
throw nextError;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/react",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.0.0-beta.
|
4
|
+
"version": "1.0.0-beta.6",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -34,11 +34,11 @@
|
|
34
34
|
"react": ">=18.0.0"
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
|
-
"@orpc/client": "1.0.0-beta.
|
38
|
-
"@orpc/contract": "1.0.0-beta.
|
39
|
-
"@orpc/openapi-client": "1.0.0-beta.
|
40
|
-
"@orpc/server": "1.0.0-beta.
|
41
|
-
"@orpc/shared": "1.0.0-beta.
|
37
|
+
"@orpc/client": "1.0.0-beta.6",
|
38
|
+
"@orpc/contract": "1.0.0-beta.6",
|
39
|
+
"@orpc/openapi-client": "1.0.0-beta.6",
|
40
|
+
"@orpc/server": "1.0.0-beta.6",
|
41
|
+
"@orpc/shared": "1.0.0-beta.6"
|
42
42
|
},
|
43
43
|
"devDependencies": {
|
44
44
|
"react": "^19.1.0",
|