import urlJoin from "url-join"; export const API_ROOT_URL = "http://techgames.gnetx.com/infoscreen"; export const CONTENT_ROOT_URL = urlJoin(API_ROOT_URL, "/listings"); export enum ListingType { IMAGE = "IMAGE", VIDEO = "VIDEO", } export interface Listing { name: string; type: ListingType; content: string; time?: number; } export interface Data { listings: Listing[]; } export async function fetchData(): Promise { const response = await fetch(`${API_ROOT_URL}/config.json`, { cache: "no-store", }); return await response.json(); } export function generateContentURL(content: string): string { // return new URL(`/${encodeURIComponent(content)}`, CONTENT_ROOT_URL); return urlJoin(CONTENT_ROOT_URL, content); }