Skip to content

Commit c693e3c

Browse files
committed
Remove useless hook useAnswer
1 parent ea77db8 commit c693e3c

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

web/frontend/src/components/utils/useConfiguration.tsx

+3-26
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import { useEffect, useState } from 'react';
22
import { Answers, Configuration } from 'types/configuration';
3-
import { emptyConfiguration, newAnswer } from 'types/getObjectType';
4-
import {
5-
unmarshalConfig,
6-
unmarshalConfigAndCreateAnswers,
7-
unmarshalSubjectAndCreateAnswers,
8-
} from 'types/JSONparser';
3+
import { emptyConfiguration } from 'types/getObjectType';
4+
import { unmarshalConfig, unmarshalConfigAndCreateAnswers } from 'types/JSONparser';
95

106
// Returns a Configuration and the initialized Answers
117
const useConfiguration = (configObj: any) => {
@@ -40,23 +36,4 @@ const useConfigurationOnly = (configObj: any) => {
4036
return configuration;
4137
};
4238

43-
// Custom hook to create answers from a Configuration.
44-
const useAnswers = (configuration: Configuration) => {
45-
const [answers, setAnswers] = useState<Answers>(null);
46-
47-
useEffect(() => {
48-
if (configuration !== null) {
49-
const newAnswers: Answers = newAnswer();
50-
51-
for (const subjectObj of configuration.Scaffold) {
52-
unmarshalSubjectAndCreateAnswers(subjectObj, newAnswers);
53-
}
54-
55-
setAnswers(newAnswers);
56-
}
57-
}, [configuration]);
58-
59-
return { answers, setAnswers };
60-
};
61-
62-
export { useConfiguration, useConfigurationOnly, useAnswers };
39+
export { useConfiguration, useConfigurationOnly };

0 commit comments

Comments
 (0)