Skip to content

Commit

Permalink
Adapter update in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
AnumQ committed Aug 1, 2024
1 parent bb34723 commit c9194c1
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 9 deletions.
54 changes: 46 additions & 8 deletions app/routes/adapter.$name.update/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
};
1 change: 0 additions & 1 deletion app/routes/adapter.$name/ComponentSelector.tsx
Original file line number Diff line number Diff line change
@@ -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';

Expand Down

0 comments on commit c9194c1

Please sign in to comment.