rearrange convo fetching for performance in progress

This commit is contained in:
Daniel Avila 2023-02-13 23:14:35 -05:00
parent c00a2c902b
commit e4d1ff2523
5 changed files with 21 additions and 8 deletions

View file

@ -8,7 +8,15 @@ const postRequest = async (url, { arg }) => {
return await axios.post(url, { arg });
};
export const swr = (path) => useSWR(path, fetcher);
export const swr = (path, successCallback) => {
const options = {};
if (successCallback) {
options.onSuccess = successCallback;
}
return useSWR(path, fetcher);
}
export default function manualSWR(path, type, successCallback) {
const options = {};