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

18 lines
442 B
TypeScript

import Config from 'react-native-config';
const buildURL = (type: 'cdn' | 'cdnimg' | 'email', path: string): string => {
switch (type) {
case 'cdn':
return Config.CDN_URL + '/' + path;
case 'cdnimg':
return `${Config.WEBSITE}/_next/image?url=${
Config.CDN_URL + '/' + encodeURIComponent(path)
}&w=640&q=75`;
case 'email':
return `mailto:${path}`;
}
return path;
};
export default buildURL;