@@ -3,9 +3,8 @@ import type { CameraCalibrationResult, VideoFormat } from "@/types/SettingTypes"
33import { useCameraSettingsStore } from " @/stores/settings/CameraSettingsStore" ;
44import { useStateStore } from " @/stores/StateStore" ;
55import { computed , inject , ref } from " vue" ;
6- import { getResolutionString , parseJsonFile } from " @/lib/PhotonUtils" ;
6+ import { axiosPost , getResolutionString , parseJsonFile } from " @/lib/PhotonUtils" ;
77import { useTheme } from " vuetify" ;
8- import axios from " axios" ;
98
109const theme = useTheme ();
1110
@@ -14,36 +13,11 @@ const props = defineProps<{
1413}>();
1514
1615const removeCalibration = () => {
17- axios
18- .post (" /calibration/remove" , {
19- cameraUniqueName: useCameraSettingsStore ().currentCameraSettings .uniqueName ,
20- width: props .videoFormat .resolution .width ,
21- height: props .videoFormat .resolution .height
22- })
23- .then ((response ) => {
24- useStateStore ().showSnackbarMessage ({
25- message: response .data .text || response .data ,
26- color: " success"
27- });
28- })
29- .catch ((error ) => {
30- if (error .response ) {
31- useStateStore ().showSnackbarMessage ({
32- color: " error" ,
33- message: error .response .data .text || error .response .data
34- });
35- } else if (error .request ) {
36- useStateStore ().showSnackbarMessage ({
37- color: " error" ,
38- message: " Error while trying to process the request! The backend didn't respond."
39- });
40- } else {
41- useStateStore ().showSnackbarMessage ({
42- color: " error" ,
43- message: " An error occurred while trying to process the request."
44- });
45- }
46- });
16+ axiosPost (" /calibration/remove" , " delete a camera calibration" , {
17+ cameraUniqueName: useCameraSettingsStore ().currentCameraSettings .uniqueName ,
18+ width: props .videoFormat .resolution .width ,
19+ height: props .videoFormat .resolution .height
20+ });
4721};
4822
4923const exportCalibration = ref ();
0 commit comments