fix(auth): make things work

This commit is contained in:
Michael Zetterberg
2024-05-20 09:05:49 +02:00
parent c4912bbb94
commit 476e9f7582
19 changed files with 122 additions and 82 deletions
+1 -4
View File
@@ -23,6 +23,7 @@ function fakingRequest<T>(payload: T): Promise<T> {
export const userQueryRouter = router({
get: protectedProcedure.query(async function ({ ctx }) {
const apiResponse = await api.get(api.endpoints.v0.profile, {
cache: "no-store",
headers: {
Authorization: `Bearer ${ctx.session.token.access_token}`,
},
@@ -164,10 +165,6 @@ export const userQueryRouter = router({
}
const apiJson = await apiResponse.json()
if (!apiJson.data?.length) {
throw notFound(apiJson)
}
const verifiedData = getStaysSchema.safeParse(apiJson)
if (!verifiedData.success) {
throw internalServerError(verifiedData.error)