new currently playing music card
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}),
|
||||
})
|
||||
Reference in New Issue
Block a user