feat: api.php를 sammoAPI()로 통일

This commit is contained in:
2021-12-26 01:58:26 +09:00
parent d23c17d172
commit fad8358096
5 changed files with 61 additions and 139 deletions
+2 -14
View File
@@ -318,6 +318,7 @@ import { clone, shuffle, sum } from "lodash";
import axios from "axios";
import { InvalidResponse } from "@/defs";
import NumberInputWithInfo from "@/components/NumberInputWithInfo.vue";
import { sammoAPI } from "./util/sammoAPI";
declare const nationList: {
nation: number;
@@ -534,21 +535,8 @@ export default defineComponent({
async submitForm() {
//검증은 언제 되어야 하는가?
const args = clone(this.args);
let result: InvalidResponse;
try {
const response = await axios({
url: "api.php",
method: "post",
responseType: "json",
data: {
path: ["General", "Join"],
args,
},
});
result = response.data;
if (!result.result) {
throw result.reason;
}
await sammoAPI(["General", "Join"], args);
} catch (e) {
console.error(e);
alert(`실패했습니다: ${e}`);