feat(SW-360): Added register form with server action
This commit is contained in:
committed by
Chuma McPhoy
parent
c69e4b4b29
commit
e086857072
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user