feat: add blocks for loyalty page
This commit is contained in:
27
server/routers/loyalty/query.ts
Normal file
27
server/routers/loyalty/query.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { allLevels } from "./temp"
|
||||
import { protectedProcedure, publicProcedure, router } from "@/server/trpc"
|
||||
|
||||
function fakingRequest<T>(payload: T): Promise<T> {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve(payload)
|
||||
}, 1500)
|
||||
})
|
||||
}
|
||||
|
||||
export const lotaltyQueryRouter = router({
|
||||
levels: router({
|
||||
all: publicProcedure.query(async function ({ ctx }) {
|
||||
// TODO: Make request to get user data from Scandic API
|
||||
return await fakingRequest<typeof allLevels>(allLevels)
|
||||
}),
|
||||
current: protectedProcedure.query(async function (opts) {
|
||||
// TODO: Make request to get user data from Scandic API
|
||||
return await fakingRequest<(typeof allLevels)[number]>(allLevels[1])
|
||||
}),
|
||||
next: protectedProcedure.query(async function (opts) {
|
||||
// TODO: Make request to get user data from Scandic API
|
||||
return await fakingRequest<(typeof allLevels)[number]>(allLevels[2])
|
||||
}),
|
||||
}),
|
||||
})
|
||||
Reference in New Issue
Block a user