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.
2021-11-07 10:11:51 +00:00
|
|
|
import Config from 'react-native-config';
|
2021-04-04 09:11:15 +00:00
|
|
|
|
2021-04-21 17:55:26 +00:00
|
|
|
const buildURL = (type: 'cdn' | 'cdnimg' | 'email', path: string): string => {
|
2021-04-04 09:11:15 +00:00
|
|
|
switch (type) {
|
|
|
|
case 'cdn':
|
2021-11-07 10:11:51 +00:00
|
|
|
return Config.CDN_URL + '/' + path;
|
2021-04-10 07:14:55 +00:00
|
|
|
case 'cdnimg':
|
2021-11-07 10:11:51 +00:00
|
|
|
return `${Config.WEBSITE}/_next/image?url=${
|
|
|
|
Config.CDN_URL + '/' + encodeURIComponent(path)
|
|
|
|
}&w=640&q=75`;
|
2021-04-21 17:55:26 +00:00
|
|
|
case 'email':
|
2021-04-11 08:54:45 +00:00
|
|
|
return `mailto:${path}`;
|
2021-04-04 09:11:15 +00:00
|
|
|
}
|
2021-04-10 07:14:55 +00:00
|
|
|
return path;
|
2021-04-04 09:11:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default buildURL;
|