Codeminer42/cm42-central

View on GitHub
app/assets/javascripts/models/beta/attachmentUrl.js

Summary

Maintainability
A
0 mins
Test Coverage
export const cloudnaryUrl = () => process.env.CLOUDINARY_URL;

export const cloudName = () =>
  cloudnaryUrl().substring(cloudnaryUrl().indexOf('@') + 1);

export const uploadPreset = () => process.env.CLOUDINARY_UPLOAD_PRESET;

export const uploadUrl = () => {
  return `https://api.cloudinary.com/v1_1/${cloudName()}/upload`;
};

export const getFileLink = (resourceType, path) => {
  return `http://res.cloudinary.com/${cloudName()}/${resourceType}/upload/${path}`;
};