feat: 턴 선택기를 vue 기반으로 변경

This commit is contained in:
2021-11-28 01:57:46 +09:00
parent c7219eeb33
commit 2538dc5071
12 changed files with 548 additions and 342 deletions
+28
View File
@@ -0,0 +1,28 @@
import axios from "axios";
import { isArray } from "lodash";
import { InvalidResponse } from "../defs";
type ValidResponse = {
result: true
}
export async function sammoAPI<ResultType extends ValidResponse>(path: string | string[], args?: Record<string, unknown>): Promise<ResultType> {
if (isArray(path)) {
path = path.join('/');
}
const response = await axios({
url: "api.php",
method: "post",
responseType: "json",
data: {
path,
args,
},
});
const result: InvalidResponse | ResultType = response.data;
if (!result.result) {
throw result.reason;
}
return result;
}