Refactor: replace endpointsConfig recoil store with react query (#1085)

This commit is contained in:
Danny Avila 2023-10-21 13:50:29 -04:00 committed by GitHub
parent 7d6a1d260f
commit 4073b7d05d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 83 additions and 49 deletions

View file

@ -1,11 +1,13 @@
import { useRecoilValue } from 'recoil';
import { useMemo, useCallback } from 'react';
import { useUpdateUserKeysMutation, useUserKeyQuery } from 'librechat-data-provider';
import store from '~/store';
import {
useUpdateUserKeysMutation,
useUserKeyQuery,
useGetEndpointsQuery,
} from 'librechat-data-provider';
const useUserKey = (endpoint: string) => {
const endpointsConfig = useRecoilValue(store.endpointsConfig);
const config = endpointsConfig[endpoint];
const { data: endpointsConfig } = useGetEndpointsQuery();
const config = endpointsConfig?.[endpoint];
const { azure } = config ?? {};
let keyEndpoint = endpoint;