File tree Expand file tree Collapse file tree 3 files changed +19
-8
lines changed
authentication/data-provider-integration
routing/redirects/react-router Expand file tree Collapse file tree 3 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -217,7 +217,11 @@ export const authProvider: AuthProvider = {
217
217
if (error ?.status === 401 ) {
218
218
return {
219
219
logout: true ,
220
- error: { message: " Unauthorized" },
220
+ error: {
221
+ message: " Unauthorized" ,
222
+ name: " Error" ,
223
+ statusCode: error ?.status ?? 403 ,
224
+ },
221
225
};
222
226
}
223
227
Original file line number Diff line number Diff line change @@ -261,14 +261,18 @@ import { AuthProvider } from "@refinedev/core";
261
261
262
262
export const authProvider: AuthProvider = {
263
263
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
+ },
269
272
}
273
+ }
270
274
271
- return {};
275
+ return {};
272
276
},
273
277
getIdentity: async () => {
274
278
const response = await fetch("https://api.fake-rest.refine.dev/auth/me", {
Original file line number Diff line number Diff line change @@ -162,7 +162,10 @@ export const authProvider: AuthProvider = {
162
162
if (error?.status === 401) {
163
163
return {
164
164
logout: true,
165
- error: { message: "Unauthorized" },
165
+ error: { message: "Unauthorized",
166
+ name: "Error",
167
+ statusCode: error?.status ?? 403,
168
+ },
166
169
};
167
170
}
168
171
You can’t perform that action at this time.
0 commit comments