Removed useless console.logs, switched errors to console.error

This commit is contained in:
Dmitriy Shishkov 2021-08-09 10:50:43 +03:00
parent 8705feffbc
commit 582e64db0d
No known key found for this signature in database
GPG Key ID: 14358F96FCDD8060
3 changed files with 2 additions and 7 deletions

View File

@ -21,11 +21,8 @@ export const useBookState = (
}, [hash]);
useEffect(() => {
console.log(Boolean(!ready && state?.currentPage && goToPage));
if (!ready && state?.currentPage && pagesReady) {
console.log("Go to", state.currentPage);
goToPage(state.currentPage);
console.log("Ready");
setReady(true);
} else if (hash && !ready && pagesReady && typeof state === "object") {
saveBookState(hash, { currentPage: 0 });
@ -36,7 +33,6 @@ export const useBookState = (
useEffect(
() => () => {
if (hash) {
console.log(currentPage);
if (ready && state) saveBookState(hash, state);
else saveBookState(hash, { currentPage: currentPage.current || 0 });
}

View File

@ -26,7 +26,6 @@ self.addEventListener("fetch", (event) => {
let handlers: PathHandler[];
if (request.url.startsWith(API_URL)) {
console.log("API: ", path);
handlers = [
{ path: "/list", getResponse: () => handleBooks() },
{ path: "/book/", getResponse: () => handleBook(request, getHash(path)) },

View File

@ -34,7 +34,7 @@ export const submitFile = async (
return await res.json();
} catch (err) {
console.log("Network error:", err.message);
console.error("Network error:", err.message);
throw err;
}
};
@ -44,7 +44,7 @@ export const validateResponse = (content: unknown): content is BookT => {
for (const key of requiredBookProps)
if (!(key in content)) {
if (process.env.NODE_ENV === "development")
console.log(`${key} is not specified in server response`);
console.error(`${key} is not specified in server response`);
return false;
}