.snkt
.snkt
Explore posts from servers
TTCTheo's Typesafe Cult
Created by .snkt on 5/15/2023 in #questions
How to redirect using TRPC?
I am generating stripe checkout url from trpc endpoint and want to redirect user to that page. Here is what I am doing right now
export const purchaseRouter = createTRPCRouter({
getUrl: publicProcedure
.input(z.object({ text: z.string() }))
.query(async ({ input, ctx }) => {
const host = ctx.req.headers.host;
if (!host) {
throw new Error("No host");
}
const session = await stripe.checkout.sessions.create({
line_items: [
{
price: "price_1N7vQ8CxIhQOHpG7clowFgAm",
quantity: 1,
},
],
mode: "payment",
success_url: `https://${host}/?success=true`,
cancel_url: `https://${host}/?canceled=true`,
});
ctx.res.redirect(303, session.url);
}),
});
export const purchaseRouter = createTRPCRouter({
getUrl: publicProcedure
.input(z.object({ text: z.string() }))
.query(async ({ input, ctx }) => {
const host = ctx.req.headers.host;
if (!host) {
throw new Error("No host");
}
const session = await stripe.checkout.sessions.create({
line_items: [
{
price: "price_1N7vQ8CxIhQOHpG7clowFgAm",
quantity: 1,
},
],
mode: "payment",
success_url: `https://${host}/?success=true`,
cancel_url: `https://${host}/?canceled=true`,
});
ctx.res.redirect(303, session.url);
}),
});
6 replies
TTCTheo's Typesafe Cult
Created by .snkt on 4/29/2023 in #questions
Is it possible to deploy t3 app on firebase?
I have specific requirement of running the serverless function for more than 5 minutes. and vercel does not support it. where as firebase provides max timeout of 60 min. which is perfectly suitable for me. Greatly appreciate any other suggestion?
7 replies
TTCTheo's Typesafe Cult
Created by .snkt on 3/7/2023 in #questions
How to fix "Invalid environment variables"
29 replies
TTCTheo's Typesafe Cult
Created by .snkt on 3/4/2023 in #questions
How to call useQuery conditionally?
18 replies