Skip to content

Commit 353d4aa

Browse files
committed
fix(react): use correct check for refresh token
The check for `data.errors` was invalid if the call was successful, resulting in a javascript error
1 parent 25f98d8 commit 353d4aa

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/eight-timers-kick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@labdigital/federated-token-react": patch
3+
---
4+
5+
Fix error when refreshing access token

packages/react/src/provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ export function AuthProvider({
312312
}
313313

314314
// Check if there is a GraphQL error
315-
if (data.errors.length > 0) {
315+
if (data.errors && data.errors.length > 0) {
316316
throw new Error("Failed to refresh token");
317317
}
318318
return true;

0 commit comments

Comments
 (0)