diff --git a/webui/src/server/routes/api/get/albumSearch.ts b/webui/src/server/routes/api/get/albumSearch.ts index 1b099b34..c6143fa3 100644 --- a/webui/src/server/routes/api/get/albumSearch.ts +++ b/webui/src/server/routes/api/get/albumSearch.ts @@ -1,7 +1,7 @@ import { Deezer } from "deezer-sdk"; import type { RequestHandler } from "express"; -import { sessionDZ } from "../../../deemixApp.js"; -import type { ApiHandler } from "../../../types.js"; +import { sessionDZ } from "@/deemixApp.js"; +import type { ApiHandler } from "@/types.js"; export interface RawAlbumQuery { term: string; @@ -29,13 +29,13 @@ const handler: RequestHandler = async ( const dz = sessionDZ[req.session.id]; if (!req.query) { - return res.status(400).send(); + res.status(400).send(); } const { term, start, nb } = parseQuery(req.query); if (!term || term.trim() === "") { - return res.status(400).send(); + res.status(400).send(); } const results = await dz.gw.search_music(term, "ALBUM", { @@ -52,7 +52,7 @@ const handler: RequestHandler = async ( total: albums.length, }; - return res.send(output); + res.send(output); }; export const apiHandler = { path, handler }; diff --git a/webui/src/server/routes/api/get/analyzeLink.ts b/webui/src/server/routes/api/get/analyzeLink.ts index 1586b7d5..63ce5f2e 100644 --- a/webui/src/server/routes/api/get/analyzeLink.ts +++ b/webui/src/server/routes/api/get/analyzeLink.ts @@ -22,7 +22,7 @@ const handler: RequestHandler = async ( ) => { try { if (!req.query || !req.query.term) { - return res + res .status(400) .send({ errorMessage: "No term specified", errorCode: "AL01" }); } @@ -37,14 +37,12 @@ const handler: RequestHandler = async ( const apiMethod = linkType === "track" ? "get_track" : "get_album"; const resBody: ResBody = await dz.api[apiMethod](linkId); - return res.status(200).send(resBody); + res.status(200).send(resBody); } - return res - .status(400) - .send({ errorMessage: "Not supported", errorCode: "AL02" }); + res.status(400).send({ errorMessage: "Not supported", errorCode: "AL02" }); } catch (error) { - return res.status(500).send({ + res.status(500).send({ errorMessage: "The server had a problem. Please try again", errorObject: error, errorCode: "AL03", diff --git a/webui/src/server/routes/api/get/getChartTracks.ts b/webui/src/server/routes/api/get/getChartTracks.ts index dc322833..89c4bf2d 100644 --- a/webui/src/server/routes/api/get/getChartTracks.ts +++ b/webui/src/server/routes/api/get/getChartTracks.ts @@ -35,7 +35,7 @@ const handler: RequestHandler = async ( index, limit, }); - return res.status(200).send(response); + res.status(200).send(response); } catch (error) { if (error instanceof BadRequestError) { logger.error(error.message); diff --git a/webui/src/server/routes/api/get/newReleases.ts b/webui/src/server/routes/api/get/newReleases.ts index 6eed9f86..dd9aedbf 100644 --- a/webui/src/server/routes/api/get/newReleases.ts +++ b/webui/src/server/routes/api/get/newReleases.ts @@ -57,7 +57,7 @@ const handler: ApiHandler["handler"] = async (req, res) => { total: albums.length, }; - return res.send(output); + res.send(output); }; const apiHandler: ApiHandler = { path, handler }; diff --git a/webui/src/server/routes/api/post/changeAccount.ts b/webui/src/server/routes/api/post/changeAccount.ts index b28c1141..06e30e97 100644 --- a/webui/src/server/routes/api/post/changeAccount.ts +++ b/webui/src/server/routes/api/post/changeAccount.ts @@ -14,7 +14,7 @@ const handler: RequestHandler = ( res ) => { if (!req.query || !req.query.child) { - return res + res .status(400) .send({ errorMessage: "No child specified", errorCode: "CA01" }); } @@ -26,7 +26,7 @@ const handler: RequestHandler = ( const accountData = dz.changeAccount(accountNum); - return res.status(200).send(accountData); + res.status(200).send(accountData); }; const apiHandler: ApiHandler = { path, handler }; diff --git a/webui/src/server/routes/api/post/loginArl.ts b/webui/src/server/routes/api/post/loginArl.ts index 243410c2..4ebeea16 100644 --- a/webui/src/server/routes/api/post/loginArl.ts +++ b/webui/src/server/routes/api/post/loginArl.ts @@ -1,5 +1,3 @@ -import { Deezer } from "deezer-sdk"; -import type { RequestHandler } from "express"; import { DeemixApp, sessionDZ } from "@/deemixApp.js"; import { logger } from "@/helpers/logger.js"; import { @@ -7,6 +5,8 @@ import { saveLoginCredentials, } from "@/helpers/loginStorage.js"; import { type ApiHandler } from "@/types.js"; +import { Deezer } from "deezer-sdk"; +import type { RequestHandler } from "express"; export interface RawLoginArlBody { arl: string; @@ -33,11 +33,11 @@ const handler: RequestHandler = async ( const isSingleUser: boolean = req.app.get("isSingleUser"); if (!req.body) { - return res.status(400).send(); + res.status(400).send(); } if (!req.body.arl) { - return res.status(400).send(); + res.status(400).send(); } const loginParams: { arl: string; child?: number } = { arl: req.body.arl }; @@ -87,7 +87,7 @@ const handler: RequestHandler = async ( arl: returnValue.arl, }); } else if (isSingleUser) resetLoginCredentials(); - return res.status(200).send(returnValue); + res.status(200).send(returnValue); }; const apiHandler = { path, handler };