|
@@ -9,14 +9,13 @@ let storage: Pick<QuestionnaireStorage, 'dialogId'> & { questions: Questionnaire
|
|
|
|
|
|
export function questionnaireMethod(data = []) {
|
|
|
if ( !data?.length ) { storage = { questions: [] }; }
|
|
|
- const step = storage.questions.length;
|
|
|
return HTTP.Post(
|
|
|
`/fdhb-tablet/dialogueManage/dialog/${ visitor.patientId }/${ visitor.resultId }`,
|
|
|
- { step, ...toQuestionnaireData(data, { dialogId: storage.dialogId, questions: storage.questions[ step - 1 ] }) },
|
|
|
+ toQuestionnaireData(data, storage),
|
|
|
{
|
|
|
transform(data: Record<string, any>, headers) {
|
|
|
- const { storage: { dialogId, questions }, model } = fromQuestionnaireData(data);
|
|
|
- storage = { dialogId, questions: questions.length ? [ ...storage.questions, questions ] : [] };
|
|
|
+ const { storage: _storage, model } = fromQuestionnaireData(data);
|
|
|
+ storage = _storage;
|
|
|
return model;
|
|
|
},
|
|
|
},
|