Skip to content

Commit d30164d

Browse files
Error type warning (#6790)
1 parent c76672d commit d30164d

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

documentation/tutorial/authentication/data-provider-integration/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,11 @@ export const authProvider: AuthProvider = {
217217
if (error?.status === 401) {
218218
return {
219219
logout: true,
220-
error: { message: "Unauthorized" },
220+
error: {
221+
message: "Unauthorized",
222+
name: "Error",
223+
statusCode: error?.status ?? 403,
224+
},
221225
};
222226
}
223227

documentation/tutorial/authentication/data-provider-integration/sandpack.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,18 @@ import { AuthProvider } from "@refinedev/core";
261261
262262
export const authProvider: AuthProvider = {
263263
onError: async (error) => {
264-
if (error?.status === 401) {
265-
return {
266-
logout: true,
267-
error: { message: "Unauthorized" },
268-
}
264+
if (error?.status === 401) {
265+
return {
266+
logout: true,
267+
error: {
268+
message: "Unauthorized",
269+
name: “Error”,
270+
statusCode: error?.status ?? 403,
271+
},
269272
}
273+
}
270274
271-
return {};
275+
return {};
272276
},
273277
getIdentity: async () => {
274278
const response = await fetch("https://api.fake-rest.refine.dev/auth/me", {

documentation/tutorial/routing/redirects/react-router/sandpack.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,10 @@ export const authProvider: AuthProvider = {
162162
if (error?.status === 401) {
163163
return {
164164
logout: true,
165-
error: { message: "Unauthorized" },
165+
error: { message: "Unauthorized",
166+
name: "Error",
167+
statusCode: error?.status ?? 403,
168+
},
166169
};
167170
}
168171

0 commit comments

Comments
 (0)