Remove api keys from old world (#2548)

* Use apiKeyV2 for getApiKeys

* Use apiKeyV2 for createApiKey

* Use apiKeyV2 for getApiKey

* Use apiKeyV2 to deleteapikey

* Filter null revokedAt -> not working

* Use apiKeyV2 to regenerate

* Fix default values injected

* Remove useless stuff

* Fix type
This commit is contained in:
martmull
2023-11-16 18:14:04 +01:00
committed by GitHub
parent 31adb24ffd
commit e8a1d0d6d5
9 changed files with 179 additions and 76 deletions

View File

@ -1,4 +1,5 @@
import { useMutation } from '@apollo/client';
import { v4 } from 'uuid';
import { useOptimisticEffect } from '@/apollo/optimistic-effect/hooks/useOptimisticEffect';
import { useFindOneObjectMetadataItem } from '@/object-metadata/hooks/useFindOneObjectMetadataItem';
@ -41,16 +42,7 @@ export const useCreateOneObjectRecord = ({
? async (input: Record<string, any>) => {
const createdObject = await mutate({
variables: {
input: {
...foundObjectMetadataItem.fields.reduce(
(result, field) => ({
...result,
[field.name]: defaultFieldValues[field.type],
}),
{},
),
...input,
},
input: { ...input, id: v4() },
},
});
@ -60,6 +52,7 @@ export const useCreateOneObjectRecord = ({
`create${capitalize(foundObjectMetadataItem.nameSingular)}`
],
);
return createdObject.data;
}
: undefined;