Fix typescript errors

This commit is contained in:
Ramon Wenger 2022-12-29 14:47:30 +01:00
parent 5bcfda9156
commit 3aa5e52e20
5 changed files with 20 additions and 10 deletions

View File

@ -29,7 +29,8 @@ const block = computed(() => {
});
// can't use the type as component name, as some are reserved HTML components, e.g. video
const COMPONENTS: Record<string, InstanceType<typeof VideoBlock>> = {
const COMPONENTS: Record<string, any> = {
// todo: can we find a better type here than any? ^
placeholder: PlaceholderBlock,
video: VideoBlock,
assignment: DescriptionTextBlock,

View File

@ -25,7 +25,8 @@ const keydown = (e: KeyboardEvent) => {
}
};
const input = (e: Event) => {
log.debug("input", e.type, e.target.checked, e.target.value);
const target = e.target as HTMLInputElement;
log.debug("input", e.type, target.checked, target.value);
emit("toggle");
};
</script>

View File

@ -10,7 +10,7 @@
<div class="flex justify-between align-items-center justify-items-center space-x-6">
<RadioGroupOption
v-for="item in items"
:key="item.id"
:key="item.value"
as="template"
class="flex-1"
:value="item.value"

View File

@ -4,7 +4,7 @@
<textarea
:value="modelValue"
class="w-full border-gray-500 h-40"
@input="$emit('update:modelValue', $event.target.value)"
@input="onInput"
/>
</div>
</template>
@ -14,5 +14,10 @@ defineProps<{
modelValue: string;
label: string;
}>();
defineEmits(["update:modelValue"]);
const emit = defineEmits(["update:modelValue"]);
const onInput = (event: Event) => {
const target = event.target as HTMLInputElement;
emit("update:modelValue", target.value);
};
</script>

View File

@ -29,12 +29,15 @@ export const useCockpitStore = defineStore({
actions: {
async loadCourseSessionUsers(courseSlug: string, reload = false) {
log.debug("loadCockpitData called");
const data = await itGetCached(`/api/course/sessions/${courseSlug}/users/`, {
reload: reload,
});
const { users, cockpit_user: cockpitUser } = await itGetCached(
`/api/course/sessions/${courseSlug}/users/`,
{
reload: reload,
}
);
this.courseSessionUsers = data.users;
this.cockpitSessionUser = data.cockpit_user;
this.courseSessionUsers = users;
this.cockpitSessionUser = cockpitUser;
if (this.cockpitSessionUser && this.cockpitSessionUser.circles?.length > 0) {
this.selectedCircles = [this.cockpitSessionUser.circles[0].translation_key];