mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
feat: integrate trpc to app
This commit is contained in:
1 parent
529869671c
commit
55a41dd3b5
7 files changed
+50
-6
No files matched your search
@@ -1,11 +1,12 @@
|
||||
import { router, publicProcedure } from '../trpc.js'
|
||||
import { linkRouter } from './linkRouter.js'
|
||||
|
||||
export const appRouter = router({
|
||||
userList: publicProcedure.query(async (opts) => {
|
||||
// Retrieve users from a datasource, this is an imaginary database
|
||||
return opts.ctx
|
||||
}),
|
||||
links: linkRouter,
|
||||
})
|
||||
// Export type router type signature,
|
||||
// NOT the router itself.
|
||||
|
||||
export type AppRouter = typeof appRouter
|
||||
@@ -0,0 +1,11 @@
|
||||
import config from '../config.js'
|
||||
import { publicProcedure, router } from '../trpc.js'
|
||||
|
||||
export const linkRouter = router({
|
||||
surveyLink: publicProcedure.query(() => {
|
||||
return config.surveyUrl
|
||||
}),
|
||||
bugReportLink: publicProcedure.query(() => {
|
||||
return config.bugReportUrl
|
||||
}),
|
||||
})
|
||||
Reference in new issue
Block a user