IO-3092 Imgproxy changes, Split client,

This commit is contained in:
Patrick Fic
2025-02-26 20:27:02 -08:00
parent dc6cd88e8c
commit 023de62244
12 changed files with 126 additions and 32 deletions

View File

@@ -5,14 +5,14 @@ import env from "../env";
import { client } from "../graphql/client";
import { INSERT_NEW_DOCUMENT } from "../graphql/documents.queries";
import { axiosAuthInterceptorId } from "./CleanAxios";
import { splitClient } from "../components/screen-main/screen-main.component";
//Context: currentUserEmail, bodyshop, jobid, invoiceid
//Required to prevent headers from getting set and rejected from Cloudinary.
var cleanAxios = axios.create();
cleanAxios.interceptors.request.eject(axiosAuthInterceptorId);
export const handleUpload = async (ev, context, destination) => {
export const handleUpload = async (ev, context) => {
const { mediaId, onError, onSuccess, onProgress } = ev;
const { bodyshop, jobId } = context;
@@ -22,6 +22,10 @@ export const handleUpload = async (ev, context, destination) => {
).blob();
let extension = imageData.localUri.split(".").pop();
//Default to Cloudinary in case of split treatment errors.
let destination =
splitClient?.getTreatment("Imgproxy") === "on" ? "imgproxy" : "cloudinary";
let key =
destination === "imgproxy"
? `${bodyshop.id}/${jobId}/${replaceAccents(