Replies: 3 comments 2 replies
-
|
yo, so since ur doing multi-tenant with Stripe, u probs just need the path string to slap onto ur tenant origin. |
Beta Was this translation helpful? Give feedback.
-
|
@CanRau Struggling to get this to work too...I have a server side method that needs to run outside of the Start context which means I don't have access to the but since Any luck on your end the past few weeks? |
Beta Was this translation helpful? Give feedback.
-
|
The fix is a dedicated lightweight server router with import { createMemoryHistory, createRouter } from '@tanstack/react-router'
import { routeTree } from '~/routeTree.gen'
const serverRouter = createRouter({ routeTree })
serverRouter.update({
history: createMemoryHistory({ initialEntries: ['/'] }),
})
export function buildServerPath(opts) {
return serverRouter.buildLocation(opts).href
}Don't import your app's Simpler alternative: build the URL on the client where the router is already initialized, pass it to the server function, and validate the origin server-side. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
There's currently nothing like
buildLocationon the server side right?I'm looking for the most ergonomic way to generate
callbackUrls on the server, for things like Stripe, that are url rewrite aware etc for a multi tenant app. Ideally I'd have somebuildLocation/linkOptionsinterface to construct those urls, maybe I'd just prefix the correct tenant's origin 🤔linkOptionsis of course available, but just a type helper.I could also pass the
buildLocationgeneratedcallbackUrlfrom the client to the server function, although I'd need to validate it and still thinkbuildLocationwould be really helpful on the server and simpler.Any tips?
Beta Was this translation helpful? Give feedback.
All reactions