feat(ui): add optional token for auth

This commit is contained in:
Mary Hipp 2023-04-05 13:08:39 -04:00
parent f6c6f61da6
commit e69a65b304
2 changed files with 7 additions and 0 deletions

View File

@ -71,6 +71,7 @@ interface InvokeProps extends PropsWithChildren {
apiUrl?: string;
disabledPanels?: string[];
disabledTabs?: InvokeTabName[];
token?: string;
}
declare function Invoke(props: InvokeProps): JSX.Element;

View File

@ -27,18 +27,24 @@ interface Props extends PropsWithChildren {
apiUrl?: string;
disabledPanels?: string[];
disabledTabs?: InvokeTabName[];
token?: string;
}
export default function Component({
apiUrl,
disabledPanels = [],
disabledTabs = [],
token,
children,
}: Props) {
useEffect(() => {
if (apiUrl) OpenAPI.BASE = apiUrl;
}, [apiUrl]);
useEffect(() => {
if (token) OpenAPI.TOKEN = token;
}, [token]);
return (
<React.StrictMode>
<Provider store={store}>