Files
medusa-store/packages/medusa/src/api/admin/api-keys/helpers.ts
Riqwan Thamir 442b0b2038 chore: rename route from api-v2 to api (#7379)
* chore: rename route from api-v2 to api

* chore: change oas references

* chore: remove v2 ref
2024-05-21 10:44:02 +02:00

24 lines
563 B
TypeScript

import { MedusaContainer } from "@medusajs/types"
import {
ContainerRegistrationKeys,
remoteQueryObjectFromString,
} from "@medusajs/utils"
export const refetchApiKey = async (
apiKeyId: string,
scope: MedusaContainer,
fields: string[]
) => {
const remoteQuery = scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
const queryObject = remoteQueryObjectFromString({
entryPoint: "api_key",
variables: {
filters: { id: apiKeyId },
},
fields: fields,
})
const apiKeys = await remoteQuery(queryObject)
return apiKeys[0]
}