import { authedAPIRequest } from "../../utils/auth"; // get the canvas of a room and deserialize it async function getCanvas(room) { if (!room) { console.error("Cannot fetch canvas of an undefined room"); return null; } const response = await authedAPIRequest("/rooms/" + room + "/canvas", { method: "GET", }); if (!response.ok) { console.error("Could not retrieve room canvas: " + response.statusText); console.debug(await response.text()); return null; } const res = await response.json(); console.debug(`Retrieved canvas for room ${room}:`); console.debug(res); return res; } // subscribe to the stream of a room function subscribeToRoom() {} // get the pixel info of a room function getPixelInfo() {} // place a pixel in a room function placePixel() {} export { getCanvas, subscribeToRoom, getPixelInfo, placePixel };