IO-3092 Imgproxy changes, Split client,
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user