Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const fileValueToMutationValue = function(value) {
// File is already uploaded, we just need to return the uuid of the file for unite.
if(value.origin === FileOrigin.LOCAL) {
return value.serverId;
}
// File is a new input, so we need to pass the upload token, created by unite cms.
else if(value.origin === FileOrigin.INPUT) {
return value.getMetadata('uniteInformation').token;
}
throw "Invalid file origin";
};