fix: undefined in student invite link
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
import { invitationModal, resetForm } from './store';
|
import { invitationModal, resetForm } from './store';
|
||||||
import { course, setCourse } from '$lib/components/Course/store';
|
import { course, setCourse } from '$lib/components/Course/store';
|
||||||
import { MultiSelect, Loading } from 'carbon-components-svelte';
|
import { MultiSelect, Loading } from 'carbon-components-svelte';
|
||||||
import { currentOrg } from '$lib/utils/store/org';
|
import { currentOrg, currentOrgDomain } from '$lib/utils/store/org';
|
||||||
import { getOrgTeam } from '$lib/utils/services/org';
|
import { getOrgTeam } from '$lib/utils/services/org';
|
||||||
import type { OrgTeamMember } from '$lib/utils/types/org';
|
import type { OrgTeamMember } from '$lib/utils/types/org';
|
||||||
import { VARIANTS } from '$lib/components/PrimaryButton/constants';
|
import { VARIANTS } from '$lib/components/PrimaryButton/constants';
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
triggerSendEmail,
|
triggerSendEmail,
|
||||||
NOTIFICATION_NAME
|
NOTIFICATION_NAME
|
||||||
} from '$lib/utils/services/notification/notification';
|
} from '$lib/utils/services/notification/notification';
|
||||||
|
import { snackbar } from '$lib/components/Snackbar/store';
|
||||||
|
|
||||||
interface Tutor {
|
interface Tutor {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -29,7 +30,6 @@
|
|||||||
let selectedIds: Array<number> = [];
|
let selectedIds: Array<number> = [];
|
||||||
let selectedTutors: Tutor[] = [];
|
let selectedTutors: Tutor[] = [];
|
||||||
let isLoadingTutors = false;
|
let isLoadingTutors = false;
|
||||||
let link = '';
|
|
||||||
let copied = false;
|
let copied = false;
|
||||||
|
|
||||||
function notEmpty<TValue>(value: TValue | null | undefined): value is TValue {
|
function notEmpty<TValue>(value: TValue | null | undefined): value is TValue {
|
||||||
@@ -113,6 +113,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function copyLink() {
|
function copyLink() {
|
||||||
|
if (!$currentOrgDomain) {
|
||||||
|
snackbar.error('Org data missing, please reload the page');
|
||||||
|
console.error('No current org domain');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const link = getStudentInviteLink($course, $currentOrg.siteName, $currentOrgDomain);
|
||||||
copy(link);
|
copy(link);
|
||||||
copied = true;
|
copied = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -126,8 +133,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$: setTutors($currentOrg.id, $invitationModal.open);
|
$: setTutors($currentOrg.id, $invitationModal.open);
|
||||||
|
|
||||||
$: link = getStudentInviteLink($course, $currentOrg.siteName);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
|
|||||||
Reference in New Issue
Block a user