update types and use of authcallback
Signed-off-by: Karl Haworth <karl.haworth@aa.com>
This commit is contained in:
+2
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user