mirror of
https://github.com/gethomepage/homepage.git
synced 2026-09-27 06:21:18 -07:00
Chore: full react hooks eslint compliance (#7040)
This commit is contained in:
@@ -2,13 +2,13 @@ import useSWR from "swr";
|
||||
|
||||
import { formatProxyUrl } from "./api-helpers";
|
||||
|
||||
export default function useWidgetAPI(widget, ...options) {
|
||||
const config = {};
|
||||
if (options && options[1]?.refreshInterval) {
|
||||
config.refreshInterval = options[1].refreshInterval;
|
||||
export default function useWidgetAPI(widget, endpoint, queryParams, swrConfig = {}) {
|
||||
const config = { ...swrConfig };
|
||||
if (queryParams?.refreshInterval) {
|
||||
config.refreshInterval = queryParams.refreshInterval;
|
||||
}
|
||||
let url = formatProxyUrl(widget, ...options);
|
||||
if (options[0] === "") {
|
||||
let url = formatProxyUrl(widget, endpoint, queryParams);
|
||||
if (endpoint === "") {
|
||||
url = null;
|
||||
}
|
||||
const { data, error, mutate } = useSWR(url, config);
|
||||
|
||||
Reference in New Issue
Block a user