mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-09 11:31:27 +00:00
19 lines
792 B
TypeScript
19 lines
792 B
TypeScript
import environmentVariables from "./EnvironmentVariables";
|
|
|
|
export async function get_media_url(mediaId: string) {
|
|
//This is for prod when we have the proper info on the url.
|
|
const api_base_url = environmentVariables.values.BASE_API;
|
|
const url = `${api_base_url}/v1/media_files/file/${mediaId}`;
|
|
|
|
const response = await fetch(url);
|
|
const json = await JSON.parse(await response.text());
|
|
const bucketPath = json["media_file"]["public_bucket_path"];
|
|
|
|
//const media_api_base_url = environmentVariables.values.GOOGLE_API;
|
|
const media_api_base_url = "https://cdn-2.fakeyou.com";
|
|
//const media_base_url = `${media_api_base_url}/vocodes-public`;
|
|
//const media_url = `${media_base_url}${bucketPath}`;
|
|
const media_url = `${media_api_base_url}${bucketPath}`;
|
|
return media_url;
|
|
}
|