feat: add blocks for loyalty page

This commit is contained in:
Christel Westerberg
2024-04-23 16:54:34 +02:00
parent fc0e5aed02
commit 2ddabf1e50
22 changed files with 418 additions and 109 deletions

View 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])
}),
}),
})