Skip to content

Commit e89adec

Browse files
committed
code upgraded
1 parent 92be675 commit e89adec

File tree

143 files changed

+8325
-4749
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+8325
-4749
lines changed

.eslintrc.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

.gitignore

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
# dependencies
44
/node_modules
55
/.pnp
6-
.pnp.js
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
712

813
# testing
914
/coverage
@@ -23,15 +28,16 @@
2328
npm-debug.log*
2429
yarn-debug.log*
2530
yarn-error.log*
31+
.pnpm-debug.log*
2632

27-
# local env files
28-
.env*.local
33+
# env files (can opt-in for committing if needed)
34+
.env*
2935

3036
# vercel
3137
.vercel
3238

3339
# typescript
3440
*.tsbuildinfo
3541
next-env.d.ts
36-
.vscode
37-
.env
42+
43+
.vscode

.vercelignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

actions/get-album-by-id.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"use server";
2+
3+
import { auth } from "@/lib/auth";
4+
import { getRequestWrapper } from "@/lib/get-request-wrapper";
5+
import { Album } from "@/types/types";
6+
import { headers } from "next/headers";
7+
8+
export const getAlbumById = async (albumId: string) => {
9+
const session = await auth.api.getSession({
10+
headers: await headers(),
11+
});
12+
if (!session) {
13+
throw new Error("Invalid request");
14+
}
15+
16+
const data = await getRequestWrapper<Album>(`/albums/${albumId}`);
17+
18+
return data;
19+
};

actions/get-artist-albums.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"use server";
2+
3+
import { auth } from "@/lib/auth";
4+
import { getRequestWrapper } from "@/lib/get-request-wrapper";
5+
import { Album } from "@/types/types";
6+
import { headers } from "next/headers";
7+
8+
export const getArtistAlbums = async (artistId: string) => {
9+
const session = await auth.api.getSession({
10+
headers: await headers(),
11+
});
12+
if (!session) {
13+
throw new Error("Invalid request");
14+
}
15+
16+
const data = await getRequestWrapper<{ items: Album[] }>(
17+
`/artists/${artistId}/albums?include_groups=album`
18+
);
19+
20+
return data?.items;
21+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"use server";
2+
3+
import { auth } from "@/lib/auth";
4+
import { getRequestWrapper } from "@/lib/get-request-wrapper";
5+
import { Album } from "@/types/types";
6+
import { headers } from "next/headers";
7+
8+
export const getArtistAppearsOnAlbums = async (artistId: string) => {
9+
const session = await auth.api.getSession({
10+
headers: await headers(),
11+
});
12+
if (!session) {
13+
throw new Error("Invalid request");
14+
}
15+
16+
const data = await getRequestWrapper<{ items: Album[] }>(
17+
`/artists/${artistId}/albums?include_groups=appears_on`
18+
);
19+
20+
return data?.items;
21+
};

actions/get-artist-by-id.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"use server";
2+
3+
import { auth } from "@/lib/auth";
4+
import { getRequestWrapper } from "@/lib/get-request-wrapper";
5+
import { Artist } from "@/types/types";
6+
import { headers } from "next/headers";
7+
8+
export const getArtistById = async (artistId: string) => {
9+
const session = await auth.api.getSession({
10+
headers: await headers(),
11+
});
12+
if (!session) {
13+
throw new Error("Invalid request");
14+
}
15+
16+
const data = await getRequestWrapper<Artist>(`/artists/${artistId}`);
17+
18+
return data;
19+
};

actions/get-artist-compilation.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"use server";
2+
3+
import { auth } from "@/lib/auth";
4+
import { getRequestWrapper } from "@/lib/get-request-wrapper";
5+
import { Album } from "@/types/types";
6+
import { headers } from "next/headers";
7+
8+
export const getArtistCompilation = async (artistId: string) => {
9+
const session = await auth.api.getSession({
10+
headers: await headers(),
11+
});
12+
if (!session) {
13+
throw new Error("Invalid request");
14+
}
15+
16+
const data = await getRequestWrapper<{ items: Album[] }>(
17+
`/artists/${artistId}/albums?include_groups=compilation`
18+
);
19+
20+
return data?.items;
21+
};

actions/get-artist-singles.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"use server";
2+
3+
import { auth } from "@/lib/auth";
4+
import { getRequestWrapper } from "@/lib/get-request-wrapper";
5+
import { Album } from "@/types/types";
6+
import { headers } from "next/headers";
7+
8+
export const getArtistSingles = async (artistId: string) => {
9+
const session = await auth.api.getSession({
10+
headers: await headers(),
11+
});
12+
if (!session) {
13+
throw new Error("Invalid request");
14+
}
15+
16+
const data = await getRequestWrapper<{ items: Album[] }>(
17+
`/artists/${artistId}/albums?include_groups=single`
18+
);
19+
20+
return data?.items;
21+
};

actions/get-artist-top-tracks.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"use server";
2+
3+
import { auth } from "@/lib/auth";
4+
import { getRequestWrapper } from "@/lib/get-request-wrapper";
5+
import { Track } from "@/types/types";
6+
import { headers } from "next/headers";
7+
8+
export const getArtistTopTracks = async (artistId: string) => {
9+
const session = await auth.api.getSession({
10+
headers: await headers(),
11+
});
12+
if (!session) {
13+
throw new Error("Invalid request");
14+
}
15+
16+
const data = await getRequestWrapper<{ tracks: Track[] }>(
17+
`/artists/${artistId}/top-tracks?market=from_token`
18+
);
19+
20+
return data?.tracks;
21+
};

0 commit comments

Comments
 (0)