diff --git a/app/routes/adapter.$name.update/route.tsx b/app/routes/adapter.$name.update/route.tsx index cf888ba..a560392 100644 --- a/app/routes/adapter.$name.update/route.tsx +++ b/app/routes/adapter.$name.update/route.tsx @@ -12,19 +12,57 @@ export const action = async ({ request, params }: ActionFunctionArgs) => { 'shortDescription', actionName ); + const note = getFormData(formData.get('note'), 'note', actionName); const orgName = await getSelectedOprganization(request); + const actionType = formData.get('actionType') || ''; + let response = null; - response = await AdapterAPI.updateAdapter( - { - name: name, - shortDescription: shortDescription as string, - note: note as string, - }, - orgName - ); + // switch (actionType) { + // case 'UPDATE_CLIENT_IN_ASSET': + // let clientUpdateType = getFormData( + // formData.get('updateType'), + // 'updateType', + // actionName + // ); + // const clientName = getFormData(formData.get('clientName'), 'clientName', actionName); + // response = await AssetApi.updateClientInAsset( + // clientName, + // id, + // orgName, + // clientUpdateType + // ); + // return json({ ok: response.status === 204 ? true : false }); + // case 'UPDATE_ADAPTER_IN_ASSET': + // let adapterUpdateType = getFormData( + // formData.get('updateType'), + // 'updateType', + // actionName + // ); + // const adapterName = getFormData(formData.get('adapterName'), 'adapterName', actionName); + // response = await AssetApi.updateAdapterInAsset( + // adapterName, + // id, + // orgName, + // adapterUpdateType + // ); + // return json({ ok: response.status === 204 ? true : false }); + // default: + // response = await AdapterAPI.updateAdapter( + // { + // name: name, + // shortDescription: shortDescription as string, + // note: note as string, + // }, + // orgName + // ); + + // console.log("response.status") + // console.log(response.status) + // return json({ ok: response.status === 200 ? true : false }); + return redirect(`/adapter/${name}`); }; diff --git a/app/routes/adapter.$name/ComponentSelector.tsx b/app/routes/adapter.$name/ComponentSelector.tsx index 1c6c9dc..1f9b674 100644 --- a/app/routes/adapter.$name/ComponentSelector.tsx +++ b/app/routes/adapter.$name/ComponentSelector.tsx @@ -1,7 +1,6 @@ import React from 'react'; import { Box, Heading, HGrid } from '@navikt/ds-react'; import { useSubmit } from '@remix-run/react'; -import { IClient } from '~/types/Clients'; import { IComponent } from '~/types/Component'; import ComponentsTable from '../komponenter._index/ComponentsTable';