mirror of
https://github.com/karl0ss/homepage.git
synced 2025-07-01 21:59:08 +01:00
preserve swr mutate
This commit is contained in:
parent
64b43871c6
commit
379d2e59f1
@ -7,7 +7,7 @@ export default function useWidgetAPI(widget, ...options) {
|
|||||||
if (options && options[1]?.refreshInterval) {
|
if (options && options[1]?.refreshInterval) {
|
||||||
config.refreshInterval = options[1].refreshInterval;
|
config.refreshInterval = options[1].refreshInterval;
|
||||||
}
|
}
|
||||||
const { data, error } = useSWR(formatProxyUrl(widget, ...options), config);
|
const { data, error, mutate } = useSWR(formatProxyUrl(widget, ...options), config);
|
||||||
// make the data error the top-level error
|
// make the data error the top-level error
|
||||||
return { data, error: data?.error ?? error }
|
return { data, error: data?.error ?? error, mutate }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user