new currently playing music card

This commit is contained in:
alex 3
2023-12-19 17:34:35 -05:00
parent 7468125ad3
commit 30173a5bbd
8 changed files with 175 additions and 3 deletions
+3 -1
View File
@@ -1,5 +1,6 @@
import { postRouter } from "@/server/api/routers/post";
import { linksRouter } from "./routers/links";
import { miscRouter } from "./routers/misc";
import { createTRPCRouter } from "@/server/api/trpc";
/**
@@ -9,7 +10,8 @@ import { createTRPCRouter } from "@/server/api/trpc";
*/
export const appRouter = createTRPCRouter({
post: postRouter,
links: linksRouter
links: linksRouter,
misc: miscRouter
});
// export type definition of API
+39
View File
@@ -0,0 +1,39 @@
import axios from 'axios';
import {
createTRPCRouter,
publicProcedure
} from '@/server/api/trpc';
type ImageListType = {
"size": string,
"#text": string
}
type LastTrackType = {
status: number,
track: {
"@attr": object,
"album": {
"mbid": string,
"#text": string
},
"artist": {
"mbid": string,
"#text": string,
},
"image": ImageListType[],
"mbid": string,
"name": string,
"streamable": number,
"url": string
}
}
export const miscRouter = createTRPCRouter({
song: publicProcedure
.query(async () => {
const response = await axios.get<LastTrackType>("https://api.thatalex.dev/v3/music/last-track")
return response.data
}),
})