add radio page
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { postRouter } from "@/server/api/routers/post";
|
||||
import { linksRouter } from "./routers/links";
|
||||
import { blogRouter } from "./routers/blog";
|
||||
import { miscRouter } from "./routers/misc";
|
||||
import { createTRPCRouter } from "@/server/api/trpc";
|
||||
|
||||
/**
|
||||
@@ -11,7 +12,8 @@ import { createTRPCRouter } from "@/server/api/trpc";
|
||||
export const appRouter = createTRPCRouter({
|
||||
post: postRouter,
|
||||
links: linksRouter,
|
||||
blog: blogRouter
|
||||
blog: blogRouter,
|
||||
misc: miscRouter
|
||||
});
|
||||
|
||||
// export type definition of API
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import axios from 'axios';
|
||||
import {
|
||||
createTRPCRouter,
|
||||
publicProcedure
|
||||
} from '@/server/api/trpc';
|
||||
|
||||
type ImageListType = {
|
||||
"size": string,
|
||||
"#text": string
|
||||
}
|
||||
|
||||
type TrackResponseType = {
|
||||
status: number,
|
||||
data: {
|
||||
tracks: LastTrackType[]
|
||||
}
|
||||
}
|
||||
|
||||
type LastTrackType = {
|
||||
"@attr": {
|
||||
"nowplaying": string
|
||||
},
|
||||
"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<TrackResponseType>("https://api.thatalex.dev/v4/social/music")
|
||||
return response.data
|
||||
}),
|
||||
})
|
||||
Reference in New Issue
Block a user