From 970fb4955caab4fd7fd9fd88e0f218e768a8ed17 Mon Sep 17 00:00:00 2001 From: Karl Haworth Date: Fri, 5 Apr 2024 12:02:33 -0400 Subject: [PATCH] update types and use of authcallback Signed-off-by: Karl Haworth --- .../ApolloExplorerBrowser/ApolloExplorerBrowser.tsx | 4 ++-- .../src/components/ApolloExplorerPage/ApolloExplorerPage.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/apollo-explorer/src/components/ApolloExplorerBrowser/ApolloExplorerBrowser.tsx b/plugins/apollo-explorer/src/components/ApolloExplorerBrowser/ApolloExplorerBrowser.tsx index e50b4847a2..d0c90708a1 100644 --- a/plugins/apollo-explorer/src/components/ApolloExplorerBrowser/ApolloExplorerBrowser.tsx +++ b/plugins/apollo-explorer/src/components/ApolloExplorerBrowser/ApolloExplorerBrowser.tsx @@ -57,7 +57,7 @@ export type ApolloEndpointProps = { type Props = { endpoints: ApolloEndpointProps[]; - authCallback?: () => Promise; + authCallback?: () => Promise<{ token: string }>; }; export const handleAuthRequest = ({ @@ -71,7 +71,7 @@ export const handleAuthRequest = ({ headers: { ...options.headers, ...(authCallback && { - Authorization: `Bearer ${await authCallback()}`, + Authorization: `Bearer ${(await authCallback()).token}`, }), }, }); diff --git a/plugins/apollo-explorer/src/components/ApolloExplorerPage/ApolloExplorerPage.tsx b/plugins/apollo-explorer/src/components/ApolloExplorerPage/ApolloExplorerPage.tsx index fbbced24d1..b9d25a1a06 100644 --- a/plugins/apollo-explorer/src/components/ApolloExplorerPage/ApolloExplorerPage.tsx +++ b/plugins/apollo-explorer/src/components/ApolloExplorerPage/ApolloExplorerPage.tsx @@ -48,7 +48,7 @@ export type EndpointProps = { */ export type AuthCallback = (options: { apiHolder: ApiHolder; -}) => Promise; +}) => Promise<{ token: string }>; type Props = { title?: string | undefined;