feat: unify react-query query keys
This commit is contained in:
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useActionSubsteps({ appKey, actionKey }) {
|
||||
const query = useQuery({
|
||||
queryKey: ['actionSubsteps', appKey, actionKey],
|
||||
queryKey: ['apps', appKey, 'actions', actionKey, 'substeps'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(
|
||||
`/v1/apps/${appKey}/actions/${actionKey}/substeps`,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useActions(appKey) {
|
||||
const query = useQuery({
|
||||
queryKey: ['actions', appKey],
|
||||
queryKey: ['apps', appKey, 'actions'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/apps/${appKey}/actions`, {
|
||||
signal,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useAdminAppAuthClient(id) {
|
||||
const query = useQuery({
|
||||
queryKey: ['adminAppAuthClient', id],
|
||||
queryKey: ['admin', 'appAuthClients', id],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/admin/app-auth-clients/${id}`, {
|
||||
signal,
|
||||
|
@@ -3,13 +3,13 @@ import { useQuery } from '@tanstack/react-query';
|
||||
import api from 'helpers/api';
|
||||
|
||||
export default function useAdminSamlAuthProviderRoleMappings({
|
||||
adminSamlAuthProviderId,
|
||||
adminSamlAuthProviderId: providerId,
|
||||
}) {
|
||||
const query = useQuery({
|
||||
queryKey: ['adminSamlAuthProviderRoleMappings', adminSamlAuthProviderId],
|
||||
queryKey: ['admin', 'samlAuthProviders', providerId, 'roleMappings'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(
|
||||
`/v1/admin/saml-auth-providers/${adminSamlAuthProviderId}/role-mappings`,
|
||||
`/v1/admin/saml-auth-providers/${providerId}/role-mappings`,
|
||||
{
|
||||
signal,
|
||||
},
|
||||
@@ -17,7 +17,7 @@ export default function useAdminSamlAuthProviderRoleMappings({
|
||||
|
||||
return data;
|
||||
},
|
||||
enabled: !!adminSamlAuthProviderId,
|
||||
enabled: !!providerId,
|
||||
});
|
||||
|
||||
return query;
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useAdminSamlAuthProviders() {
|
||||
const query = useQuery({
|
||||
queryKey: ['adminSamlAuthProviders'],
|
||||
queryKey: ['admin', 'samlAuthProviders'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get('/v1/admin/saml-auth-providers', {
|
||||
signal,
|
||||
|
@@ -3,7 +3,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useAdminUser({ userId }) {
|
||||
const query = useQuery({
|
||||
queryKey: ['admin', 'user', userId],
|
||||
queryKey: ['admin', 'users', userId],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/admin/users/${userId}`, {
|
||||
signal,
|
||||
|
@@ -3,7 +3,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useAdminUsers(page) {
|
||||
const query = useQuery({
|
||||
queryKey: ['admin', 'users', page],
|
||||
queryKey: ['admin', 'users', { page }],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/admin/users`, {
|
||||
signal,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useApp(appKey) {
|
||||
const query = useQuery({
|
||||
queryKey: ['app', appKey],
|
||||
queryKey: ['apps', appKey],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/apps/${appKey}`, {
|
||||
signal,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useAppAuth(appKey) {
|
||||
const query = useQuery({
|
||||
queryKey: ['appAuth', appKey],
|
||||
queryKey: ['apps', appKey, 'auth'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/apps/${appKey}/auth`, {
|
||||
signal,
|
||||
|
@@ -3,7 +3,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useAppConfig(appKey) {
|
||||
const query = useQuery({
|
||||
queryKey: ['appConfig', appKey],
|
||||
queryKey: ['apps', appKey, 'config'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/apps/${appKey}/config`, {
|
||||
signal,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useAppConnections(appKey) {
|
||||
const query = useQuery({
|
||||
queryKey: ['appConnections', appKey],
|
||||
queryKey: ['apps', appKey, 'connections'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/apps/${appKey}/connections`, {
|
||||
signal,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useAppFlows({ appKey, page }, { enabled }) {
|
||||
const query = useQuery({
|
||||
queryKey: ['appFlows', appKey, page],
|
||||
queryKey: ['apps', appKey, 'flows', { page }],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/apps/${appKey}/flows`, {
|
||||
params: {
|
||||
|
@@ -8,7 +8,7 @@ export default function useAutomatischInfo() {
|
||||
* So we can set the `staleTime` to Infinity
|
||||
**/
|
||||
staleTime: Infinity,
|
||||
queryKey: ['automatischInfo'],
|
||||
queryKey: ['automatisch', 'info'],
|
||||
queryFn: async (payload, signal) => {
|
||||
const { data } = await api.get('/v1/automatisch/info', { signal });
|
||||
|
||||
|
@@ -7,7 +7,7 @@ export default function useConnectionFlows(
|
||||
{ enabled } = {},
|
||||
) {
|
||||
const query = useQuery({
|
||||
queryKey: ['connectionFlows', connectionId, page],
|
||||
queryKey: ['connections', connectionId, 'flows', { page }],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/connections/${connectionId}/flows`, {
|
||||
params: {
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useCurrentUser() {
|
||||
const query = useQuery({
|
||||
queryKey: ['currentUser'],
|
||||
queryKey: ['users', 'me'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/users/me`, {
|
||||
signal,
|
||||
|
@@ -74,7 +74,7 @@ function useDynamicFields(stepId, schema) {
|
||||
}, [schema, formValues, getValues]);
|
||||
|
||||
const query = useQuery({
|
||||
queryKey: ['dynamicFields', stepId, computedVariables],
|
||||
queryKey: ['steps', stepId, 'dynamicFields', computedVariables],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.post(
|
||||
`/v1/steps/${stepId}/dynamic-fields`,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useExecution({ executionId }) {
|
||||
const query = useQuery({
|
||||
queryKey: ['execution', executionId],
|
||||
queryKey: ['executions', executionId],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/executions/${executionId}`, {
|
||||
signal,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useExecutionSteps({ executionId }) {
|
||||
const query = useInfiniteQuery({
|
||||
queryKey: ['executionSteps', executionId],
|
||||
queryKey: ['executions', executionId, 'executionSteps'],
|
||||
queryFn: async ({ pageParam = 1, signal }) => {
|
||||
const { data } = await api.get(
|
||||
`/v1/executions/${executionId}/execution-steps`,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useExecutions({ page }, { refetchInterval } = {}) {
|
||||
const query = useQuery({
|
||||
queryKey: ['executions', page],
|
||||
queryKey: ['executions', { page }],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/executions`, {
|
||||
params: {
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useFlow(flowId) {
|
||||
const query = useQuery({
|
||||
queryKey: ['flow', flowId],
|
||||
queryKey: ['flows', flowId],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/flows/${flowId}`, {
|
||||
signal,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useInvoices() {
|
||||
const query = useQuery({
|
||||
queryKey: ['invoices'],
|
||||
queryKey: ['users', 'invoices'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get('/v1/users/invoices', {
|
||||
signal,
|
||||
|
@@ -3,7 +3,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function usePaddleInfo() {
|
||||
const query = useQuery({
|
||||
queryKey: ['paddleInfo'],
|
||||
queryKey: ['payment', 'paddleInfo'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get('/v1/payment/paddle-info', {
|
||||
signal,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function usePaymentPlans() {
|
||||
const query = useQuery({
|
||||
queryKey: ['paymentPlans'],
|
||||
queryKey: ['payment', 'plans'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get('/v1/payment/plans', {
|
||||
signal,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function usePermissionCatalog() {
|
||||
const query = useQuery({
|
||||
queryKey: ['permissionCatalog'],
|
||||
queryKey: ['admin', 'permissions', 'catalog'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get('/v1/admin/permissions/catalog', {
|
||||
signal,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function usePlanAndUsage(userId) {
|
||||
const query = useQuery({
|
||||
queryKey: ['planAndUsage', userId],
|
||||
queryKey: ['users', userId, 'planAndUsage'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/users/${userId}/plan-and-usage`, {
|
||||
signal,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useRole({ roleId }) {
|
||||
const query = useQuery({
|
||||
queryKey: ['role', roleId],
|
||||
queryKey: ['admin', 'roles', roleId],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/admin/roles/${roleId}`, {
|
||||
signal,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
export default function useRoles() {
|
||||
const query = useQuery({
|
||||
staleTime: 0,
|
||||
queryKey: ['roles'],
|
||||
queryKey: ['admin', 'roles'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get('/v1/admin/roles', {
|
||||
signal,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useSamlAuthProvider({ samlAuthProviderId } = {}) {
|
||||
const query = useQuery({
|
||||
queryKey: ['samlAuthProvider', samlAuthProviderId],
|
||||
queryKey: ['samlAuthProviders', samlAuthProviderId],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(
|
||||
`/v1/admin/saml-auth-providers/${samlAuthProviderId}`,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useStepConnection(stepId) {
|
||||
const query = useQuery({
|
||||
queryKey: ['stepConnection', stepId],
|
||||
queryKey: ['steps', stepId, 'connection'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/steps/${stepId}/connection`, {
|
||||
signal,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useStepWithTestExecutions(stepId) {
|
||||
const query = useQuery({
|
||||
queryKey: ['stepWithTestExecutions', stepId],
|
||||
queryKey: ['steps', stepId, 'previousSteps'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/steps/${stepId}/previous-steps`, {
|
||||
signal,
|
||||
|
@@ -25,7 +25,7 @@ export default function useSubscription() {
|
||||
const [isPolling, setIsPolling] = React.useState(false);
|
||||
|
||||
const { data } = useQuery({
|
||||
queryKey: ['subscription'],
|
||||
queryKey: ['users', 'me', 'subscription'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/users/me/subscription`, {
|
||||
signal,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useTriggerSubsteps({ appKey, triggerKey }) {
|
||||
const query = useQuery({
|
||||
queryKey: ['triggerSubsteps', appKey, triggerKey],
|
||||
queryKey: ['apps', appKey, 'triggers', triggerKey, 'substeps'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(
|
||||
`/v1/apps/${appKey}/triggers/${triggerKey}/substeps`,
|
||||
|
@@ -4,7 +4,7 @@ import api from 'helpers/api';
|
||||
|
||||
export default function useTriggers(appKey) {
|
||||
const query = useQuery({
|
||||
queryKey: ['triggers', appKey],
|
||||
queryKey: ['apps', appKey, 'triggers'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/apps/${appKey}/triggers`, {
|
||||
signal,
|
||||
|
@@ -42,7 +42,7 @@ export default function useUserTrial() {
|
||||
const formatMessage = useFormatMessage();
|
||||
|
||||
const { data } = useQuery({
|
||||
queryKey: ['userTrial'],
|
||||
queryKey: ['users', 'me', 'trial'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get('/v1/users/me/trial', {
|
||||
signal,
|
||||
|
@@ -7,7 +7,7 @@ import api from 'helpers/api';
|
||||
export default function useVersion() {
|
||||
const { data: notificationsData } = useAutomatischNotifications();
|
||||
const { data } = useQuery({
|
||||
queryKey: ['automatischVersion'],
|
||||
queryKey: ['automatisch', 'version'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get('/v1/automatisch/version', {
|
||||
signal,
|
||||
|
Reference in New Issue
Block a user