Skip to content

Commit 272b7b4

Browse files
authored
feat: Add redirect through Quartz after self-removal (#3719)
* ✨ Add redirect to `CLOUD_URL` after self-removal * 🎨 Add braces to `if` current user check
1 parent 837015b commit 272b7b4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/users/context/users.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ import {GTM_USER_REMOVED} from 'src/users/constants'
3131
// Types
3232
import {CloudUser, DraftInvite, Invite, RemoteDataState} from 'src/types'
3333
import {getOrg} from 'src/organizations/selectors'
34+
import {getMe} from 'src/me/selectors'
35+
import {CLOUD_URL} from 'src/shared/constants'
3436

3537
export type Props = {
3638
children: JSX.Element
@@ -76,6 +78,8 @@ export const UsersContext = React.createContext<UsersContextType>(
7678
export const UsersProvider: FC<Props> = React.memo(({children}) => {
7779
const dispatch = useDispatch()
7880
const orgId = useSelector(getOrg)?.id
81+
const currentUserId = useSelector(getMe)?.id
82+
7983
const [users, setUsers] = useState<CloudUser[]>([])
8084
const [invites, setInvites] = useState<Invite[]>([])
8185
const [draftInvite, setDraftInvite] = useState<DraftInvite>(draft)
@@ -217,6 +221,10 @@ export const UsersProvider: FC<Props> = React.memo(({children}) => {
217221
window.dataLayer.push({
218222
event: GTM_USER_REMOVED,
219223
})
224+
225+
if (userId == currentUserId) {
226+
window.location.href = CLOUD_URL
227+
}
220228
} catch (error) {
221229
console.error(error)
222230
dispatch(notify(removeUserFailed()))

0 commit comments

Comments
 (0)