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

@ -0,0 +1,9 @@
import { gql } from '@apollo/client';
export const GENERATE_ONE_API_KEY_TOKEN = gql`
mutation GenerateOneApiKeyToken($data: ApiKeyCreateInput!) {
generateApiKeyV2Token(data: $data) {
token
}
}
`;

View File

@ -1,5 +1,5 @@
import { ApiFieldItem } from '@/settings/developers/types/ApiFieldItem';
import { GetApiKeysQuery } from '~/generated/graphql';
import { ApiKey } from '~/generated/graphql';
import { beautifyDateDiff } from '~/utils/date-utils';
export const formatExpiration = (
@ -18,9 +18,9 @@ export const formatExpiration = (
};
export const formatExpirations = (
apiKeysQuery: GetApiKeysQuery,
apiKeys: Array<Pick<ApiKey, 'id' | 'name' | 'expiresAt'>>,
): ApiFieldItem[] => {
return apiKeysQuery.findManyApiKey.map(({ id, name, expiresAt }) => {
return apiKeys.map(({ id, name, expiresAt }) => {
return {
id,
name,