Refactor SWR imports: consolidate fetcher and mutationFetcher into units/swr, update component imports accordingly

master^2
Tudor Stanciu 2024-11-11 01:54:01 +02:00
parent 0468af03be
commit 338aa17fe8
6 changed files with 12 additions and 9 deletions

View File

@ -2,8 +2,7 @@ import React from "react";
import ReleaseNotesList from "./ReleaseNotesList"; import ReleaseNotesList from "./ReleaseNotesList";
import TimelineComponent from "../timeline/TimelineComponent"; import TimelineComponent from "../timeline/TimelineComponent";
import { endpoints } from "../../../utils/api"; import { endpoints } from "../../../utils/api";
import useSWR from "swr"; import { useSWR, fetcher } from "units/swr";
import { fetcher } from "utils/swr";
import { blip } from "utils"; import { blip } from "utils";
import { dtos } from "types"; import { dtos } from "types";

View File

@ -1,8 +1,7 @@
import React from "react"; import React from "react";
import SystemVersionComponent from "./SystemVersionComponent"; import SystemVersionComponent from "./SystemVersionComponent";
import { endpoints } from "../../../utils/api"; import { endpoints } from "../../../utils/api";
import useSWR from "swr"; import { useSWR, fetcher } from "units/swr";
import { fetcher } from "utils/swr";
import { blip } from "utils"; import { blip } from "utils";
import { dtos } from "types"; import { dtos } from "types";

View File

@ -3,9 +3,7 @@ import CacheSettingsComponent from "./CacheSettingsComponent";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { endpoints } from "utils/api"; import { endpoints } from "utils/api";
import { blip } from "utils"; import { blip } from "utils";
import useSWRMutation from "swr/mutation"; import { useSWRMutation, mutationFetcher, Key } from "units/swr";
import { Key } from "swr";
import { mutationFetcher } from "utils/swr";
const CacheSettingsContainer: React.FC = () => { const CacheSettingsContainer: React.FC = () => {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@ -1,8 +1,7 @@
import React, { useState, useContext, useMemo, ReactNode } from "react"; import React, { useState, useContext, useMemo, ReactNode } from "react";
import { endpoints } from "../utils/api"; import { endpoints } from "../utils/api";
import { PermissionsDto } from "types/dtos"; import { PermissionsDto } from "types/dtos";
import useSWR from "swr"; import { useSWR, fetcher } from "units/swr";
import { fetcher } from "utils/swr";
import { blip } from "utils"; import { blip } from "utils";
const permissionCodes = { const permissionCodes = {

View File

@ -0,0 +1,8 @@
import useSWR from "swr";
import type { Key } from "swr";
import useSWRMutation from "swr/mutation";
export * from "./fetchers";
export { useSWR, useSWRMutation };
export type { Key };