You should receive organizationId in the route and validate it against the session one because the user could change orgs in another tab.
Ready to get started?
Join Adocasts Plus for $8/mo, or sign into an existing Adocasts Plus account, to get access to all of our lessons.
Canceling an Organization Invite
We'll add the ability to cancel a sent invitation to an organization.
Join the Discussion 4 comments
-
-
Responding to jals
Hi jals! That's a great point and a use-case that slipped my mind, thanks for catching that!
Adding the
organizationId
into the route parameters is definitely a great option. If you add theorganizationId
into the URL though, I might prefer to do that across the board and drop theactive_organization
cookie altogether. That way you only have one source of truth on which organization is being worked with. Minimizing potential confusion down the road.You could, alternatively, use a Broadcast Channel to communicate across the tabs to notify the others when the
organizationId
has changed. You could then display a modal warning the user, offering to re-up their active org. You could also add an event when the tab is focused to update, set, or check the activeorganizationId
. Something like the below would probably suffice.onMounted(() => window.addEventListener('focus', onFocus)) onUnmounted(() => window.removeEventListener('focus', onFocus)) function onFocus() { router.get(`/organizations/${props.organization.id}`) }
Copied!1-
Responding to tomgobich
-
Responding to jals
-
-
-