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 // 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, placeholder: PlaceholderBlock,
video: VideoBlock, video: VideoBlock,
assignment: DescriptionTextBlock, assignment: DescriptionTextBlock,

View File

@ -25,7 +25,8 @@ const keydown = (e: KeyboardEvent) => {
} }
}; };
const input = (e: Event) => { 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"); emit("toggle");
}; };
</script> </script>

View File

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

View File

@ -4,7 +4,7 @@
<textarea <textarea
:value="modelValue" :value="modelValue"
class="w-full border-gray-500 h-40" class="w-full border-gray-500 h-40"
@input="$emit('update:modelValue', $event.target.value)" @input="onInput"
/> />
</div> </div>
</template> </template>
@ -14,5 +14,10 @@ defineProps<{
modelValue: string; modelValue: string;
label: 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> </script>

View File

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