Convert /api/users.

This commit is contained in:
Mike Cao 2025-01-21 19:10:34 -08:00
parent 090abcff81
commit baa3851fb4
61 changed files with 1064 additions and 70 deletions

View file

@ -1,23 +1,16 @@
import { useEffect } from 'react';
import useStore, { setConfig } from 'store/app';
import { useApi } from '../useApi';
let loading = false;
import { getConfig } from 'app/actions/getConfig';
export function useConfig() {
const { config } = useStore();
const { get } = useApi();
const configUrl = process.env.configUrl;
async function loadConfig() {
const data = await get(configUrl);
loading = false;
setConfig(data);
setConfig(await getConfig());
}
useEffect(() => {
if (!config && !loading && configUrl) {
loading = true;
if (!config) {
loadConfig();
}
}, []);

View file

@ -11,7 +11,7 @@ export function usePagedQuery<T = any>({
}: Omit<UseQueryOptions, 'queryFn'> & { queryFn: (params?: object) => any }): PagedQueryResult<T> {
const { query: queryParams } = useNavigation();
const [params, setParams] = useState<PageParams>({
query: '',
search: '',
page: +queryParams.page || 1,
});