diff --git a/plugins/auth-react/api-report.md b/plugins/auth-react/api-report.md
index 9c2cf4622d..660154271c 100644
--- a/plugins/auth-react/api-report.md
+++ b/plugins/auth-react/api-report.md
@@ -13,28 +13,20 @@ export function CookieAuthRefreshProvider(
// @public
export type CookieAuthRefreshProviderProps = {
pluginId: string;
- options?: {
- path?: string;
- };
+ path?: string;
children: ReactNode;
};
// @public
-export function useCookieAuthRefresh(params: {
+export function useCookieAuthRefresh(options: {
pluginId: string;
- options?: {
- path?: string;
- };
+ path?: string;
}): {
- loading: boolean;
- error: Error | undefined;
- value:
- | {
- expiresAt: string;
- }
- | undefined;
- retry: (...args: unknown[]) => Promise<{
+ status: 'loading' | 'error' | 'success';
+ error?: Error;
+ result?: {
expiresAt: string;
- }>;
+ };
+ retry: () => void;
};
```
diff --git a/plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx b/plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx
index 2b553f33e8..8f6f38e225 100644
--- a/plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx
+++ b/plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx
@@ -27,11 +27,8 @@ import { useCookieAuthRefresh } from '../../hooks';
export type CookieAuthRefreshProviderProps = {
// The plugin ID to used for discovering the API origin
pluginId: string;
- // Options for configuring the refresh cookie endpoint
- options?: {
- // The path to used for calling the refresh cookie endpoint, default to '/cookie'
- path?: string;
- };
+ // The path to used for calling the refresh cookie endpoint, default to '/cookie'
+ path?: string;
// The children to render when the refresh is successful
children: ReactNode;
};
@@ -43,17 +40,17 @@ export type CookieAuthRefreshProviderProps = {
export function CookieAuthRefreshProvider(
props: CookieAuthRefreshProviderProps,
): JSX.Element {
- const { children, ...params } = props;
+ const { children, ...options } = props;
const app = useApp();
const { Progress } = app.getComponents();
- const { loading, error, retry } = useCookieAuthRefresh(params);
+ const { status, error, retry } = useCookieAuthRefresh(options);
- if (loading) {
+ if (status === 'loading') {
return ;
}
- if (error) {
+ if (status === 'error' && error) {
return (