This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
mobile-app/src/utils/buildURL.ts

19 lines
442 B
TypeScript

import { CDN_URI, IMAGE_RESIZING_SERVICE } from 'config/cdn';
const buildURL = (type: 'cdn' | 'cdnimg' | 'email', path: string): string => {
switch (type) {
case 'cdn':
return CDN_URI + path;
case 'cdnimg':
return (
IMAGE_RESIZING_SERVICE +
`?url=${CDN_URI + encodeURIComponent(path)}&w=640&q=75`
);
case 'email':
return `mailto:${path}`;
}
return path;
};
export default buildURL;