mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): add optional token for auth
This commit is contained in:
parent
f6c6f61da6
commit
e69a65b304
1
invokeai/frontend/web/index.d.ts
vendored
1
invokeai/frontend/web/index.d.ts
vendored
@ -71,6 +71,7 @@ interface InvokeProps extends PropsWithChildren {
|
|||||||
apiUrl?: string;
|
apiUrl?: string;
|
||||||
disabledPanels?: string[];
|
disabledPanels?: string[];
|
||||||
disabledTabs?: InvokeTabName[];
|
disabledTabs?: InvokeTabName[];
|
||||||
|
token?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare function Invoke(props: InvokeProps): JSX.Element;
|
declare function Invoke(props: InvokeProps): JSX.Element;
|
||||||
|
@ -27,18 +27,24 @@ interface Props extends PropsWithChildren {
|
|||||||
apiUrl?: string;
|
apiUrl?: string;
|
||||||
disabledPanels?: string[];
|
disabledPanels?: string[];
|
||||||
disabledTabs?: InvokeTabName[];
|
disabledTabs?: InvokeTabName[];
|
||||||
|
token?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Component({
|
export default function Component({
|
||||||
apiUrl,
|
apiUrl,
|
||||||
disabledPanels = [],
|
disabledPanels = [],
|
||||||
disabledTabs = [],
|
disabledTabs = [],
|
||||||
|
token,
|
||||||
children,
|
children,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (apiUrl) OpenAPI.BASE = apiUrl;
|
if (apiUrl) OpenAPI.BASE = apiUrl;
|
||||||
}, [apiUrl]);
|
}, [apiUrl]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (token) OpenAPI.TOKEN = token;
|
||||||
|
}, [token]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
|
Loading…
Reference in New Issue
Block a user