permitir corregir mundos con contraseña incorrecta

This commit is contained in:
Cat /dev/Nulo 2023-03-18 14:07:32 +00:00
parent feefdc7a1e
commit fb943e43df

View file

@ -7,7 +7,11 @@
async function addWorld() { async function addWorld() {
const password = location.hash.slice(1); const password = location.hash.slice(1);
await writeWorlds((worlds) => [...worlds, { room: worldId, password }]); await writeWorlds((worlds) => [
// reemplazar mundo en vez de agregar nuevo, por si se agregó antes con la contraseña incorrecta
...worlds.filter(({ room }) => room !== worldId),
{ room: worldId, password },
]);
router.route(inject(routes.Page, { worldId, pageId: "index" })); router.route(inject(routes.Page, { worldId, pageId: "index" }));
} }
</script> </script>