Silence SWR api logging

This commit is contained in:
Daniel Kluge 2022-02-04 19:21:26 +01:00
parent 92ab5e449c
commit 774bce5420
2 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@ const REPLInput: NextPage<REPLInputParams> = ({historyCallback, historyClear, in
const [cmdHistory, setCmdHistory] = useState<string[]>([]);
const [usrInputTmp, setUsrInputTmp] = useState<string>("");
const [cmdIf, setCmdIf] = useState<CommandInterface>(new CommandInterface(modalManipulation, []));
const { data: projects, error: projectsError } = useSWR("/api/projects", fetchProjects);
const { data: projects, error: projectsError } = useSWR("/api/projects?swr=1", fetchProjects);
const setInput = (inputRef: HTMLInputElement, input: string) => {
const nativeSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;

View File

@ -18,7 +18,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse<string
try {
const path = resolve("./public", "projects", "list.json");
const data = readFileSync(path).toString();
console.debug("[API/projects]\tRequest for project list");
if (!req.query.swr) console.debug("[API/projects]\tRequest for project list");
res.status(200).send(data);
} catch (err) {
console.error(`[API/projects]\tError in request for project list! Code: ${(err as IFileError).code}`);