diff options
Diffstat (limited to 'src/client/views/StyleProviderQuiz.tsx')
-rw-r--r-- | src/client/views/StyleProviderQuiz.tsx | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/client/views/StyleProviderQuiz.tsx b/src/client/views/StyleProviderQuiz.tsx index 1f2ad1485..b9dd4016c 100644 --- a/src/client/views/StyleProviderQuiz.tsx +++ b/src/client/views/StyleProviderQuiz.tsx @@ -19,6 +19,7 @@ import { FieldViewProps } from './nodes/FieldView'; import { ImageBox } from './nodes/ImageBox'; import { ImageUtility } from './nodes/generativeFill/generativeFillUtils/ImageHandler'; import './StyleProviderQuiz.scss'; +import { Networking } from '../Network'; export namespace styleProviderQuiz { enum quizMode { @@ -85,18 +86,10 @@ export namespace styleProviderQuiz { if (!quizBoxes.length) { imgBox.Loading = true; - const img = { - file: i ? i : imgBox.paths[0], - drag: i ? 'drag' : 'full', - smart: quiz, - }; - const response = await axios.post('http://localhost:105/labels/', img, { - headers: { - 'Content-Type': 'application/json', - }, - }); - if (response.data['boxes'].length != 0) { - createBoxes(imgBox, response.data['boxes'], response.data['text']); + const response = await Networking.PostToServer('/labels', { file: i ? i : imgBox.paths[0], drag: i ? 'drag' : 'full', smart: quiz }); + const parsedResponse = JSON.parse(response.result.replace(/'/g, '"')); + if (parsedResponse['boxes'].length != 0) { + createBoxes(imgBox, parsedResponse['boxes'], parsedResponse['text']); } else { imgBox.Loading = false; } |