Ready to get started?

Join Adocasts Plus for $8.00/mo, or sign into your account to get access to all of our lessons.

robot mascot smiling

Canceling an Organization Invite

In this lesson, we'll add the ability to cancel a sent invitation to an organization.

Published
Jan 24
Duration
6m 5s

Developer, dog lover, and burrito eater. Currently teaching AdonisJS, a fully featured NodeJS framework, and running Adocasts where I post new lessons weekly. Professionally, I work with JavaScript, .Net C#, and SQL Server.

Adocasts

Burlington, KY

Get the Code

Download or explore the source code for this lesson on GitHub

Repository

Ready to get started?

Join Adocasts Plus for $8.00/mo, or sign into your account to get access to all of our lessons.

Join The Discussion! (4 Comments)

Please sign in or sign up for free to join in on the dicussion.

  1. Commented 1 month ago

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

    1

    Please sign in or sign up for free to reply

    1. Commented 1 month ago

      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

      Please sign in or sign up for free to reply

      1. Commented 1 month ago

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

        1

        Please sign in or sign up for free to reply

        1. Commented 1 month ago

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

          0

          Please sign in or sign up for free to reply