From b9be8a711a24f3c3ed7509bd0d94b531342837ad Mon Sep 17 00:00:00 2001 From: knom Date: Wed, 1 Jan 2025 18:41:45 +0000 Subject: [PATCH] Remove assets from list, that have been located --- src/pages/assets/missing-locations.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/pages/assets/missing-locations.tsx b/src/pages/assets/missing-locations.tsx index 7a3b30e..e475fb7 100644 --- a/src/pages/assets/missing-locations.tsx +++ b/src/pages/assets/missing-locations.tsx @@ -29,17 +29,20 @@ export default function MissingLocations() { const selectedAssets = useMemo(() => config.assets.filter((a) => config.selectedIds.includes(a.id)), [config.assets, config.selectedIds]) ; - const handleSubmit = (place: IPlace) => { - return updateAssets({ + const handleSubmit = async (place: IPlace) => { + await updateAssets({ ids: config.selectedIds, latitude: place.latitude, longitude: place.longitude, - }).then(() => { - setConfig({ - ...config, - selectedIds: [], - }); - }) + }); + + const newAssets = config.assets.filter(asset => !config.selectedIds.includes(asset.id)); + + setConfig({ + ...config, + selectedIds: [], + assets: newAssets + }); }; return (