Router: change /Discover to /Discover/map/type/filterId

This commit is contained in:
chiayin
2023-06-16 17:13:59 +08:00
parent 07b35fcce0
commit af1f8f3016
20 changed files with 121 additions and 57 deletions

View File

@@ -1,4 +1,5 @@
import Swal from 'sweetalert2'
import Swal from 'sweetalert2';
import AllMapDataStore from '@/stores/allMapData.js';
const customClass = {
htmlContainer: '!w-[564px]',
@@ -51,7 +52,8 @@ export async function savedSuccessfully(value) {
})
};
export async function leaveFilter(next, addFilterId) {
export async function leaveFilter(next, addFilterId, toPath) {
const allMapDataStore = AllMapDataStore();
const result = await Swal.fire({
title: 'ARE YOU SURE TO LEAVE MAP?',
html: 'Filter settings have not been saved.</br>Click “Save as” to save filtered results, “OK” to leave map.',
@@ -67,10 +69,11 @@ export async function leaveFilter(next, addFilterId) {
})
if(result.isConfirmed) {
await saveFilter(addFilterId)
next();
next(toPath);
}
else if(result.dismiss === 'cancel') {
next();
allMapDataStore.tempFilterId = null;
next(toPath);
}
else if(result.dismiss === 'backdrop') {
next(false);