Solved the bug where the user solutions were not loading
This commit is contained in:
@@ -13,12 +13,14 @@ export default function Speaking({id, type, title, text, prompts, userSolutions,
|
||||
const [solutionURL, setSolutionURL] = useState<string>();
|
||||
|
||||
useEffect(() => {
|
||||
if (userSolutions && userSolutions.length > 0) {
|
||||
axios.post(`/api/speaking`, {path: userSolutions[0].solution}, {responseType: "arraybuffer"}).then(({data}) => {
|
||||
const blob = new Blob([data], {type: "audio/wav"});
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
setSolutionURL(url);
|
||||
});
|
||||
}
|
||||
}, [userSolutions]);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user