@page "/invite/{inviteId?}" @inject IDataService DataService @inject AuthenticationStateProvider AuthProvider @inject IToastService Toasts

Organization Invite


@if (_joinSuccessful) {
Congratulations!

You've successfully joined the organization!

} else if (string.IsNullOrWhiteSpace(InviteId)) {
Invitation ID is missing from the request.
} else {
WARNING:

You will leave your current organization and lose access to its agents unless someone is able to invite you back in.

Are you sure you want to leave your current organization and join this one?

}
@code { private bool _joinSuccessful; [Parameter] public string? InviteId { get; init; } private async Task Confirm() { if (string.IsNullOrWhiteSpace(InviteId)) { Toasts.ShowToast2("Invitation ID is missing from the request.", ToastType.Error); return; } var state = await AuthProvider.GetAuthenticationStateAsync(); if (state.User.Identity is not { IsAuthenticated: true } identity) { Toasts.ShowToast2("You must be logged in to join an organization.", ToastType.Error); return; } var result = await DataService.JoinViaInvitation($"{identity.Name}", InviteId); if (!result.IsSuccess) { Toasts.ShowToast2(result.Reason, ToastType.Error); return; } _joinSuccessful = true; } }