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.

robot mascot smiling

Canceling an Organization Invite

@tomgobich
Published by
@tomgobich
In This Lesson

We'll add the ability to cancel a sent invitation to an organization.

Join the Discussion 4 comments

Create a free account to join in on the discussion
  1. @jals

    You should receive organizationId in the route and validate it against the session one because the user could change orgs in another tab.

    1
    1. Responding to jals
      @tomgobich

      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 the organizationId into the URL though, I might prefer to do that across the board and drop the active_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 active organizationId. 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
      1. Responding to tomgobich
        @jals

        Great! I see you're already working on this for the next lesson, keep up the good work!

        1
        1. Responding to jals
          @tomgobich

          Yeah, we'll add a fix for this at the end of lesson 13.0! 😊 Thanks again, jals!!

          0