You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have defined a few default bindings for my app routes, which depend on the currently logged in user.
How can I supply them to trail when using SSR? For the regular app, I have set up a watcher like the one below, but it does not seem to have any effect on SSR, as I get errors like Error: Ziggy error: 'user' parameter is required for route 'user.profile'
import{defineRoutes,store}from'momentum-trail'import{RouteCollection}from'momentum-trail/dist/types/types'declare global {interfaceWindow{trail: RouteCollection}}/** * This composable is used by page layout components to watch for changes in URL defaults, which * are provided by the HandleInertiaRequests middleware. This allows switching app context from * one company to another, or from guest to authenticated user without a full page reload and * ensures Trail/Ziggy has the correct URL defaults available at all times. */exportconstuseUrlDefaultsWatcher=()=>{watch(()=>usePage().props.urlDefaults,(defaults: object)=>{if(typeofwindow!=='undefined'&&window.trail){window.trail.defaults=defaults}else{defineRoutes(Object.assign(store.getRoutes(),defaults))}},{immediate: true},)}
The text was updated successfully, but these errors were encountered:
I have defined a few default bindings for my app routes, which depend on the currently logged in user.
How can I supply them to trail when using SSR? For the regular app, I have set up a watcher like the one below, but it does not seem to have any effect on SSR, as I get errors like
Error: Ziggy error: 'user' parameter is required for route 'user.profile'
The text was updated successfully, but these errors were encountered: