Skip to content

Commit

Permalink
chore/removed not necessary dependencies (#24)
Browse files Browse the repository at this point in the history
* chore: removed unused fonts

* chore: removed unnecessary package
  • Loading branch information
sirLisko authored Sep 21, 2024
1 parent dbb5079 commit 84fed13
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 29 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"dependencies": {
"axios": "^1.7.7",
"classnames": "^2.5.1",
"http-status-codes": "^2.3.0",
"lucide-react": "^0.445.0",
"modern-css-reset": "^1.4.0",
"next": "^14.2.13",
Expand Down
5 changes: 0 additions & 5 deletions pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ import Script from "next/script";
const Document = () => (
<Html lang="en">
<Head>
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
href="https://fonts.googleapis.com/css2?family=Open+Sans&family=Roboto&display=swap"
rel="stylesheet"
/>
<Script
async
defer
Expand Down
12 changes: 6 additions & 6 deletions pages/api/artists/[artistName]/events.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HttpStatusCode } from "axios";
import type { NextApiRequest, NextApiResponse } from "next";
import { StatusCodes } from "http-status-codes";
import { getClientIp } from "request-ip";

import { getArtistEvent } from "server/apis/songkick";
Expand All @@ -9,21 +9,21 @@ import { Event } from "types";
export default async (req: NextApiRequest, res: NextApiResponse<Event[]>) => {
const { artistName } = req.query as { artistName: string };
if (!artistName) {
return res.status(StatusCodes.BAD_REQUEST).end();
return res.status(HttpStatusCode.BadRequest).end();
}
const clientIp = getClientIp(req);
if (!clientIp) {
return res.status(StatusCodes.NOT_FOUND).end();
return res.status(HttpStatusCode.NotFound).end();
}
if (clientIp === "::1") {
return res.status(StatusCodes.NO_CONTENT).end();
return res.status(HttpStatusCode.NoContent).end();
}
try {
const events = await getArtistEvent(artistName, clientIp);
res.status(StatusCodes.OK).json(events);
res.status(HttpStatusCode.Ok).json(events);
} catch (e: any) {
res
.status(e?.response?.data?.code ?? StatusCodes.INTERNAL_SERVER_ERROR)
.status(e?.response?.data?.code ?? HttpStatusCode.InternalServerError)
.end(e?.response?.data?.message || "Ops! There was a problem!");
}
};
8 changes: 4 additions & 4 deletions pages/api/artists/[artistName]/spotify.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { StatusCodes } from "http-status-codes";
import { HttpStatusCode } from "axios";
import type { NextApiRequest, NextApiResponse } from "next";

import { getArtistTracks } from "server/apis/spotify";

export default async (req: NextApiRequest, res: NextApiResponse) => {
const { artistName } = req.query as { artistName: string };
if (!artistName) {
res.status(StatusCodes.BAD_REQUEST).end();
res.status(HttpStatusCode.BadRequest).end();
}
try {
const artistData = await getArtistTracks(artistName);
res.status(StatusCodes.OK).json(artistData);
res.status(HttpStatusCode.Ok).json(artistData);
} catch (e: any) {
console.error(e);
res
.status(
e?.response?.data?.code ??
e?.status ??
StatusCodes.INTERNAL_SERVER_ERROR,
HttpStatusCode.InternalServerError,
)
.end(
e?.response?.data?.message ?? e?.message ?? "Ops! There was a problem!",
Expand Down
9 changes: 4 additions & 5 deletions pages/api/artists/[artistName]/tracks.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import { StatusCodes } from "http-status-codes";

import { getArtistSetlist } from "server/apis/setlistFm";
import { getAggregatedSetlists } from "server/setlists";

import type { NextApiRequest, NextApiResponse } from "next";
import { HttpStatusCode } from "axios";

export default async (req: NextApiRequest, res: NextApiResponse) => {
const { artistName } = req.query as { artistName: string };
if (!artistName) {
return res.status(StatusCodes.BAD_REQUEST).end();
return res.status(HttpStatusCode.BadRequest).end();
}
try {
const setList = await getArtistSetlist(artistName);
res.status(StatusCodes.OK).json(getAggregatedSetlists(setList));
res.status(HttpStatusCode.Ok).json(getAggregatedSetlists(setList));
} catch (e: any) {
res
.status(e?.response?.data?.code ?? StatusCodes.INTERNAL_SERVER_ERROR)
.status(e?.response?.data?.code ?? HttpStatusCode.InternalServerError)
.end(e?.response?.data?.message || "Ops! There was a problem!");
}
};
8 changes: 0 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 84fed13

Please sign in to comment.