[improvement] copy assets when copying to multiplayer room (#694)

This commit is contained in:
Steve Ruiz 2022-05-18 21:46:24 +01:00 committed by GitHub
parent 13f5787c31
commit cacb4b7827
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 122 additions and 15 deletions

View file

@ -51,7 +51,7 @@ export default async function CreateMultiplayerRoom(req: NextApiRequest, res: Ne
// },
// }).then((d) => d.json())
//POST
// POST
const result = await fetch(`https://liveblocks.net/api/v1/room/${roomId}/storage`, {
method: 'POST',
mode: 'cors',
@ -64,10 +64,12 @@ export default async function CreateMultiplayerRoom(req: NextApiRequest, res: Ne
})
if (result.status === 200) {
res.send({ status: 'success', roomId })
res.send({ status: 'success', message: result.statusText, roomId })
} else {
res.send({ status: 'error', message: result.statusText })
}
} catch (e) {
res.send({ status: 'error' })
res.send({ status: 'error', message: e.message })
// noop
}
}