feat(SW-360): Added register form with server action

This commit is contained in:
Tobias Johansson
2024-09-11 17:10:57 +02:00
committed by Chuma McPhoy
parent c69e4b4b29
commit e086857072
11 changed files with 382 additions and 1 deletions

View File

@@ -140,6 +140,34 @@ export const serverActionProcedure = t.procedure.experimental_caller(
})
)
export const hotelServiceServerActionProcedure = serverActionProcedure.use(
async (opts) => {
const { access_token } = await fetchServiceToken("hotel")
if (!access_token) {
throw internalServerError("Failed to obtain service token")
}
return opts.next({
ctx: {
serviceToken: access_token,
},
})
}
)
export const profileServiceServerActionProcedure = serverActionProcedure.use(
async (opts) => {
const { access_token } = await fetchServiceToken("profile")
if (!access_token) {
throw internalServerError("Failed to obtain service token")
}
return opts.next({
ctx: {
serviceToken: access_token,
},
})
}
)
export const protectedServerActionProcedure = serverActionProcedure.use(
async (opts) => {
const session = await opts.ctx.auth()