fix #295 include both save and cancel cases of popup modal; however, for cases when conformance page acting as starting point, bugs are still there
This commit is contained in:
@@ -21,6 +21,7 @@ const customClass = {
|
||||
*/
|
||||
export async function saveFilter(addFilterId) {
|
||||
let fileName = '';
|
||||
|
||||
const { value, isConfirmed } = await Swal.fire({
|
||||
title: 'SAVE NEW FILTER',
|
||||
input: 'text',
|
||||
@@ -46,11 +47,15 @@ export async function saveFilter(addFilterId) {
|
||||
if(isConfirmed) { // 存檔成功
|
||||
await addFilterId(fileName);
|
||||
// 顯示儲存完成
|
||||
if (value) savedSuccessfully(value);
|
||||
if (value) { // Example of value: yes
|
||||
savedSuccessfully(value);
|
||||
}
|
||||
// 清空欄位
|
||||
fileName = '';
|
||||
return true;
|
||||
} else { // 點擊取消或空白處,為存檔失敗。
|
||||
console.log("is not confirmed");
|
||||
PageAdminStore.keepPreviousPage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -96,12 +101,16 @@ export async function leaveFilter(next, addFilterId, toPath, logOut) {
|
||||
});
|
||||
|
||||
if(result.isConfirmed) {
|
||||
//TODO:
|
||||
console.log("result of SWAL modal:", result);
|
||||
|
||||
if(allMapDataStore.createFilterId) {
|
||||
await allMapDataStore.updataFilter();
|
||||
if(allMapDataStore.isUpdataFilter) {
|
||||
await savedSuccessfully(allMapDataStore.filterName);
|
||||
}
|
||||
} else {
|
||||
// Dangerous, here shows a modal
|
||||
await saveFilter(addFilterId);
|
||||
}
|
||||
|
||||
@@ -122,8 +131,6 @@ export async function leaveFilter(next, addFilterId, toPath, logOut) {
|
||||
logOut ? null : next(false);
|
||||
}
|
||||
|
||||
// In any cases, execute the following
|
||||
pageAdminStore.clearPendingActivePage();
|
||||
};
|
||||
/**
|
||||
* Conformance Saved
|
||||
|
||||
Reference in New Issue
Block a user