Removed owner data from map state

This commit is contained in:
Mitchell McCaffrey 2020-04-26 11:37:03 +10:00
parent 671c8d7bf7
commit d8f8fb6059

View File

@ -56,9 +56,7 @@ function SelectMapModal({
// Add a state for the map if there isn't one already // Add a state for the map if there isn't one already
const state = await db.table("states").get(id); const state = await db.table("states").get(id);
if (!state) { if (!state) {
await db await db.table("states").add({ ...defaultMapState, mapId: id });
.table("states")
.add({ ...defaultMapState, mapId: id, owner: userId });
} }
} }
return defaultMapsWithIds; return defaultMapsWithIds;
@ -130,9 +128,7 @@ function SelectMapModal({
async function handleMapAdd(map) { async function handleMapAdd(map) {
await db.table("maps").add(map); await db.table("maps").add(map);
await db await db.table("states").add({ ...defaultMapState, mapId: map.id });
.table("states")
.add({ ...defaultMapState, mapId: map.id, owner: userId });
setMaps((prevMaps) => [map, ...prevMaps]); setMaps((prevMaps) => [map, ...prevMaps]);
setSelectedMap(map); setSelectedMap(map);
setGridX(map.gridX); setGridX(map.gridX);
@ -160,7 +156,7 @@ function SelectMapModal({
} }
async function handleMapReset(id) { async function handleMapReset(id) {
const state = { ...defaultMapState, mapId: id, owner: userId }; const state = { ...defaultMapState, mapId: id };
await db.table("states").put(state); await db.table("states").put(state);
// Reset the state of the current map if needed // Reset the state of the current map if needed
if (currentMap && currentMap.id === selectedMap.id) { if (currentMap && currentMap.id === selectedMap.id) {