Skip to content

Commit f6f9275

Browse files
committed
pass User instead of a user getter...
to avoid importing from authStore
1 parent e28d630 commit f6f9275

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

packages/courses/src/piano/utility/MidiConfig.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,10 @@ import SkMidi from './midi';
8383
import { Status } from '@vue-skuilder/common';
8484
import { User } from '@vue-skuilder/db';
8585
import { InputEventNoteon } from 'webmidi';
86-
import { getCurrentUser } from '@/stores/useAuthStore';
8786
import PianoRangeVisualizer from './PianoRangeVisualizer.vue';
8887
8988
export interface MidiDevice {
90-
text: string;
89+
title: string;
9190
value: string;
9291
}
9392
export default defineComponent({
@@ -102,6 +101,10 @@ export default defineComponent({
102101
type: String,
103102
required: true,
104103
},
104+
user: {
105+
type: Object as () => User,
106+
required: true,
107+
},
105108
},
106109
107110
setup(props) {
@@ -112,7 +115,6 @@ export default defineComponent({
112115
const selectedInput = ref<string>('');
113116
const selectedOutput = ref<string>('');
114117
const updatePending = ref(false);
115-
const user = ref<User>();
116118
117119
// managing config state updates
118120
const savedInputId = ref<string>('');
@@ -388,7 +390,7 @@ export default defineComponent({
388390
});
389391
390392
const retrieveSettings = async () => {
391-
const s = await user.value?.getCourseSettings(props._id);
393+
const s = await props.user.getCourseSettings(props._id);
392394
393395
if (s?.midiinput) {
394396
const savedInput = s.midiinput.toString();
@@ -435,7 +437,7 @@ export default defineComponent({
435437
436438
const saveSettings = async () => {
437439
updatePending.value = true;
438-
await user.value?.updateCourseSettings(props._id, [
440+
await props.user.updateCourseSettings(props._id, [
439441
{
440442
key: 'midiinput',
441443
value: selectedInput.value,
@@ -475,7 +477,6 @@ export default defineComponent({
475477
};
476478
477479
onMounted(async () => {
478-
user.value = await getCurrentUser();
479480
initNoteOptions();
480481
try {
481482
midi.value = await SkMidi.instance();

packages/platform-ui/src/components/Courses/CourseInformation.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</router-link>
3333
</div>
3434
</transition>
35-
<midi-config v-if="isPianoCourse" :_id="_id" class="my-3" />
35+
<midi-config v-if="isPianoCourse" :_id="_id" :user="user" class="my-3" />
3636

3737
<v-card class="my-2">
3838
<v-toolbar density="compact">

0 commit comments

Comments
 (0)