mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-13 11:17:26 +02:00
28 lines
699 B
TypeScript
28 lines
699 B
TypeScript
import useAPI from '../useApi/useApi';
|
|
|
|
export const useUiConfigApi = () => {
|
|
const { makeRequest, createRequest, errors, loading } = useAPI({
|
|
propagateErrors: true,
|
|
});
|
|
|
|
const setFrontendSettings = async (
|
|
frontendApiOrigins: string[]
|
|
): Promise<void> => {
|
|
const payload = {
|
|
frontendSettings: { frontendApiOrigins },
|
|
};
|
|
const req = createRequest(
|
|
'api/admin/ui-config',
|
|
{ method: 'POST', body: JSON.stringify(payload) },
|
|
'setFrontendSettings'
|
|
);
|
|
await makeRequest(req.caller, req.id);
|
|
};
|
|
|
|
return {
|
|
setFrontendSettings,
|
|
loading,
|
|
errors,
|
|
};
|
|
};
|