|
|
|
@ -63,6 +63,7 @@ export class UploadRoute extends Route {
|
|
|
|
|
// Uploads a file to the data directory and returns the filename
|
|
|
|
|
this.router.use(async (req, res) => {
|
|
|
|
|
let uploadConfirmation: IUploadConfirmation;
|
|
|
|
|
try {
|
|
|
|
|
if (req.session.userId) {
|
|
|
|
|
if (req.files.profilePicture) {
|
|
|
|
|
uploadConfirmation = await this.uploadProfilePicture(req);
|
|
|
|
@ -84,7 +85,13 @@ export class UploadRoute extends Route {
|
|
|
|
|
success: false,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
if (uploadConfirmation.error) {
|
|
|
|
|
} catch (err) {
|
|
|
|
|
uploadConfirmation = {
|
|
|
|
|
error: err,
|
|
|
|
|
success: false,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
if (uploadConfirmation?.error) {
|
|
|
|
|
res.status(httpStatus.BAD_REQUEST);
|
|
|
|
|
}
|
|
|
|
|
res.json(uploadConfirmation);
|
|
|
|
|