update types and use of authcallback

Signed-off-by: Karl Haworth <karl.haworth@aa.com>
This commit is contained in:
Karl Haworth
2024-04-05 12:02:33 -04:00
parent 63adc94523
commit 970fb4955c
2 changed files with 3 additions and 3 deletions
@@ -57,7 +57,7 @@ export type ApolloEndpointProps = {
type Props = {
endpoints: ApolloEndpointProps[];
authCallback?: () => Promise<string>;
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}`,
}),
},
});
@@ -48,7 +48,7 @@ export type EndpointProps = {
*/
export type AuthCallback = (options: {
apiHolder: ApiHolder;
}) => Promise<string>;
}) => Promise<{ token: string }>;
type Props = {
title?: string | undefined;