Separate system operations from core objects in GraphQL endpoints (#12977)
Moves system-level operations (auth, billing, admin) to use the /metadata endpoint instead of /graphql. This cleans up the endpoint separation so /graphql is purely for core objects (Company, People, etc.) and /metadata handles all system operations. Part of prep work for webhook/API key core migration.
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
import { useApolloClient } from '@apollo/client';
|
||||
import { isNonEmptyString, isObject } from '@sniptt/guards';
|
||||
import qs from 'qs';
|
||||
import { useMemo } from 'react';
|
||||
@ -6,6 +5,7 @@ import { useParams, useSearchParams } from 'react-router-dom';
|
||||
import { useRecoilCallback, useRecoilValue } from 'recoil';
|
||||
import z from 'zod';
|
||||
|
||||
import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
|
||||
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
|
||||
import { useObjectNameSingularFromPlural } from '@/object-metadata/hooks/useObjectNameSingularFromPlural';
|
||||
import { objectMetadataItemFamilySelector } from '@/object-metadata/states/objectMetadataItemFamilySelector';
|
||||
@ -34,7 +34,7 @@ const filterQueryParamsSchema = z.object({
|
||||
export type FilterQueryParams = z.infer<typeof filterQueryParamsSchema>;
|
||||
|
||||
export const useViewFromQueryParams = () => {
|
||||
const apolloClient = useApolloClient();
|
||||
const apolloCoreClient = useApolloCoreClient();
|
||||
const [searchParams] = useSearchParams();
|
||||
const { objectNamePlural = '' } = useParams();
|
||||
const { objectNameSingular } = useObjectNameSingularFromPlural({
|
||||
@ -118,7 +118,7 @@ export const useViewFromQueryParams = () => {
|
||||
(Array.isArray(filterValueFromURL) ||
|
||||
satisfiesRelationFilterSchema)
|
||||
) {
|
||||
const queryResult = await apolloClient.query<
|
||||
const queryResult = await apolloCoreClient.query<
|
||||
Record<string, { edges: { node: ObjectRecord }[] }>
|
||||
>({
|
||||
query: generateFindManyRecordsQuery({
|
||||
@ -180,7 +180,7 @@ export const useViewFromQueryParams = () => {
|
||||
).filter(isDefined);
|
||||
},
|
||||
[
|
||||
apolloClient,
|
||||
apolloCoreClient,
|
||||
filterQueryParams,
|
||||
hasFiltersQueryParams,
|
||||
objectMetadataItem.fields,
|
||||
|
||||
Reference in New Issue
Block a user