mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-15 17:50:48 +02:00
 ## About the changes <!-- Describe the changes introduced. What are they and why are they being introduced? Feel free to also add screenshots or steps to view the changes if they're visual. --> <!-- Does it close an issue? Multiple? --> Closes # <!-- (For internal contributors): Does it relate to an issue on public roadmap? --> <!-- Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item: # --> ### Important files <!-- PRs can contain a lot of changes, but not all changes are equally important. Where should a reviewer start looking to get an overview of the changes? Are any files particularly important? --> ## Discussion points <!-- Anything about the PR you'd like to discuss before it gets merged? Got any questions or doubts? -->
29 lines
971 B
TypeScript
29 lines
971 B
TypeScript
import useAddons from 'hooks/api/getters/useAddons/useAddons';
|
|
import { IntegrationForm } from '../IntegrationForm/IntegrationForm';
|
|
import cloneDeep from 'lodash.clonedeep';
|
|
import { DEFAULT_DATA } from '../CreateIntegration/CreateIntegration';
|
|
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
|
import { AddonSchema } from 'openapi';
|
|
|
|
export const EditIntegration = () => {
|
|
const addonId = useRequiredPathParam('addonId');
|
|
const { providers, addons, refetchAddons } = useAddons();
|
|
|
|
const editMode = true;
|
|
const addon = addons.find(
|
|
(addon: AddonSchema) => addon.id === Number(addonId)
|
|
) || { ...cloneDeep(DEFAULT_DATA) };
|
|
const provider = addon
|
|
? providers.find(provider => provider.name === addon.provider)
|
|
: undefined;
|
|
|
|
return (
|
|
<IntegrationForm
|
|
editMode={editMode}
|
|
provider={provider}
|
|
fetch={refetchAddons}
|
|
addon={addon}
|
|
/>
|
|
);
|
|
};
|