Generate question bank domain model from JDL
This commit is contained in:
1 parent
1d97cc4e31
commit
1d74d8f04b
160 files changed
+26900
-2
No files matched your search
@@ -0,0 +1,42 @@
|
||||
import { type Ref, defineComponent, inject, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { useAlertService } from '@/shared/alert/alert.service';
|
||||
import { type IQuestion } from '@/shared/model/question.model';
|
||||
|
||||
import QuestionService from './question.service';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'QuestionDetails',
|
||||
setup() {
|
||||
const questionService = inject('questionService', () => new QuestionService());
|
||||
const alertService = inject('alertService', () => useAlertService(), true);
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const previousState = () => router.go(-1);
|
||||
const question: Ref<IQuestion> = ref({});
|
||||
|
||||
const retrieveQuestion = async questionId => {
|
||||
try {
|
||||
const res = await questionService().find(questionId);
|
||||
question.value = res;
|
||||
} catch (error) {
|
||||
alertService.showHttpError(error.response);
|
||||
}
|
||||
};
|
||||
|
||||
if (route.params?.questionId) {
|
||||
retrieveQuestion(route.params.questionId);
|
||||
}
|
||||
|
||||
return {
|
||||
question,
|
||||
|
||||
previousState,
|
||||
t$: useI18n().t,
|
||||
};
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user