fix: 메인, 사령부의 alert를 toast로 이동

This commit is contained in:
2023-03-12 17:32:00 +09:00
parent ae76ce0abd
commit c88e3d1bfe
5 changed files with 75 additions and 17 deletions
+33 -6
View File
@@ -289,7 +289,7 @@ import DragSelect from "@/components/DragSelect.vue";
import { SammoAPI } from "./SammoAPI";
import type { CommandItem, CommandTableResponse } from "@/defs";
import CommandSelectForm from "@/components/CommandSelectForm.vue";
import { BButton, BButtonGroup, BDropdownItem, BDropdown, BDropdownText, BDropdownDivider } from "bootstrap-vue-3";
import { BButton, BButtonGroup, BDropdownItem, BDropdown, BDropdownText, BDropdownDivider, useToast } from "bootstrap-vue-3";
import { StoredActionsHelper } from "./util/StoredActionsHelper";
import type { TurnObj } from "@/defs";
import type { Args } from "./processing/args";
@@ -303,6 +303,8 @@ defineExpose({
reloadCommandList,
})
const toasts = unwrap(useToast());
const { maxTurn, maxPushTurn } = staticValues;
const commandList = ref<CommandTableResponse['commandTable']>([]);
@@ -436,8 +438,13 @@ async function repeatGeneralCommand(amount: number) {
try {
await SammoAPI.Command.RepeatCommand({ amount });
} catch (e) {
if(isString(e)){
toasts.danger({
title: "에러",
body: e,
});
}
console.error(e);
alert(`실패했습니다: ${e}`);
return;
}
await reloadCommandList();
@@ -447,8 +454,13 @@ async function pushGeneralCommand(amount: number) {
try {
await SammoAPI.Command.PushCommand({ amount });
} catch (e) {
if(isString(e)){
toasts.danger({
title: "에러",
body: e,
});
}
console.error(e);
alert(`실패했습니다: ${e}`);
return;
}
await reloadCommandList();
@@ -483,8 +495,13 @@ async function reloadCommandList() {
try {
result = await SammoAPI.Command.GetReservedCommand();
} catch (e) {
if(isString(e)){
toasts.danger({
title: "에러",
body: e,
});
}
console.error(e);
alert(`실패했습니다: ${e}`);
return;
}
@@ -551,8 +568,13 @@ async function reserveCommandDirect(args: [number[], TurnObj][], reload = true):
await SammoAPI.Command.ReserveBulkCommand(query);
queryActionHelper.releaseSelectedTurnList();
} catch (e) {
if(isString(e)){
toasts.danger({
title: "에러",
body: e,
});
}
console.error(e);
alert(`실패했습니다: ${e}`);
return false;
}
@@ -592,8 +614,13 @@ async function reserveCommand() {
queryActionHelper.releaseSelectedTurnList();
} catch (e) {
if(isString(e)){
toasts.danger({
title: "에러",
body: e,
});
}
console.error(e);
alert(`실패했습니다: ${e}`);
return;
}
await reloadCommandList();