mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 09:28:11 +00:00
EntityInput will specify between webcam upload errors for Google Analytics
This commit is contained in:
1 parent
1e04839871
commit
b1cff6f844
3 files changed
+19
-10
No files matched your search
+8
-1
@@ -269,7 +269,14 @@ export default function EntityInput({
|
||||
reset: resetUploader,
|
||||
} = useMediaUploader({
|
||||
autoUpload: true,
|
||||
GApage,
|
||||
onError: () => {
|
||||
// @ts-ignore
|
||||
window.dataLayer.push({
|
||||
"event": "upload_failure",
|
||||
"page": GApage || "/",
|
||||
"user_id": "$user_id"
|
||||
});
|
||||
},
|
||||
onSuccess: (res: UploaderResponse) => {
|
||||
reload();
|
||||
selectToken(res.media_file_token);
|
||||
|
||||
+8
-1
@@ -97,7 +97,14 @@ export default function CameraCapture({
|
||||
error: uploaderError,
|
||||
uploadProgress,
|
||||
} = useMediaUploader({
|
||||
GApage,
|
||||
onError: () => {
|
||||
// @ts-ignore
|
||||
window.dataLayer.push({
|
||||
"event": "upload_failure_webcam",
|
||||
"page": GApage || "/",
|
||||
"user_id": "$user_id"
|
||||
});
|
||||
},
|
||||
onSuccess: (res: UploaderResponse) => {
|
||||
handleClose();
|
||||
selectToken(res.media_file_token);
|
||||
|
||||
@@ -17,13 +17,13 @@ import { FetchStatus } from "@storyteller/components/src/api/_common/SharedFetch
|
||||
|
||||
interface Props {
|
||||
autoUpload?: boolean;
|
||||
GApage?: string;
|
||||
onError?: (res: UploaderResponse) => any;
|
||||
onSuccess?: (res: UploaderResponse) => any;
|
||||
}
|
||||
|
||||
const n = () => { };
|
||||
|
||||
export default function useMediaUploader({ autoUpload, GApage, onSuccess = n }: Props) {
|
||||
export default function useMediaUploader({ autoUpload, onError = n, onSuccess = n }: Props) {
|
||||
const [status, statusSet] = useState(FetchStatus.ready);
|
||||
const [mediaClass, mediaClassSet] = useState<MediaFileClass>(
|
||||
MediaFileClass.Unknown
|
||||
@@ -80,13 +80,8 @@ export default function useMediaUploader({ autoUpload, GApage, onSuccess = n }:
|
||||
onSuccess(res);
|
||||
todo();
|
||||
} else {
|
||||
onError(res);
|
||||
statusSet(FetchStatus.error);
|
||||
// @ts-ignore
|
||||
window.dataLayer.push({
|
||||
"event": "upload_failure",
|
||||
"page": GApage || "/",
|
||||
"user_id": "$user_id"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user