Temp fix for typescript warning

This commit is contained in:
Maksim Karasev 2021-09-06 08:42:26 +03:00
parent b7866e1339
commit fc24dbde62
6 changed files with 8 additions and 8 deletions

View File

@ -87,7 +87,7 @@ imagesRouter.get('/', async (req, res) => {
});
// Image upload
imagesRouter.post('/', async (req, res) => {
imagesRouter.post('/', async (req:any, res) => {
if (req.files === undefined) {
res.status(400).json({ status: 'error', error: 'File missing.' });
} else if (Array.isArray(req.files.file)) {

View File

@ -42,13 +42,13 @@ export const registerFileInFolder = async () => {
try {
insertImageIntoDB(file.filename, file.stat.mtime.getTime());
newCount += 1;
} catch (e) { logger.error(`${e.name}: ${e.message}`); }
} catch (e: any) { logger.error(`${e.name}: ${e.message}`); }
});
logger.info(
`Found ${filesWithStats.length} files, ${filteredFilesWithStats.length} valid images, ${newCount} new`,
);
} catch (e) {
} catch (e: any) {
logger.error(`Error while registering files ${e.message}`);
}
};

View File

@ -72,7 +72,7 @@ export const getThumbnail = async (
);
imagebuffer = await readFilePromise(`${tmpDir.name}/temp.png`);
await unlinkFilePromise(`${tmpDir.name}/temp.png`);
} catch (e) {
} catch (e: any) {
logger.error(`${e.name}:${e.message}`);
}
tmpDir.removeCallback();

View File

@ -15,7 +15,7 @@ export const validateCredentials = async (
try {
return (await bcrypt.compare(password, db.getMeta('password')))
&& username === db.getMeta('username');
} catch (e) {
} catch (e:any) {
logger.error(`validateCredentials: ${e.message}`);
return false;
}

View File

@ -274,7 +274,7 @@ function App(props: WithWidth) {
await userService.updateCredentials(oldPassword, username, password);
handleLogout();
setNotification(t('Please login with your new credentials'));
} catch (e) {
} catch (e: any) {
if (e.response.status === 401) {
setNotification(t('Check your old password and try again'));
}

View File

@ -23,7 +23,7 @@ export const doLogin = async (
},
);
return status;
} catch (e) {
} catch (e: any) {
console.error(e);
return e.response.status || 500;
}
@ -45,7 +45,7 @@ export const doRegister = async (
},
);
return status;
} catch (e) {
} catch (e: any) {
console.error(e);
return e.response.status || 500;
}