refactor: rewrite useConfig with RQ
This commit is contained in:
16
packages/web/src/hooks/useAutomatischConfig.js
Normal file
16
packages/web/src/hooks/useAutomatischConfig.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import api from 'helpers/api';
|
||||
|
||||
export default function useAutomatischConfig() {
|
||||
const query = useQuery({
|
||||
queryKey: ['automatisch', 'config'],
|
||||
queryFn: async ({ signal }) => {
|
||||
const { data } = await api.get(`/v1/automatisch/config`, {
|
||||
signal,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
});
|
||||
|
||||
return query;
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
import { useQuery } from '@apollo/client';
|
||||
import { GET_CONFIG } from 'graphql/queries/get-config.ee';
|
||||
export default function useConfig(keys) {
|
||||
const { data, loading } = useQuery(GET_CONFIG, {
|
||||
variables: { keys },
|
||||
});
|
||||
return {
|
||||
config: data?.getConfig,
|
||||
loading,
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user