refac, feat: API 호출 구조 재작성
- api.php에서 param path 강제 - api.php에서 GET param 허용 - SammoAPI 호출자를 axios에서 fetch 기반(ky)로 변경 - SammoAPI에서 단순 POST대신 REST에 따라 지정 가능하도록 재구성 - SammoAPI에서 NumVar, StrVar를 PathParam으로 변경하도록 변경 - API CallType들을 def/API로 분리 시작 - 일부 API를 시험삼아 변경(login)
This commit is contained in:
@@ -129,21 +129,13 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { BettingInfo, ToastType } from "@/defs";
|
||||
import { SammoAPI, type ValidResponse } from "@/SammoAPI";
|
||||
import type { BettingDetailResponse, BettingInfo, ToastType } from "@/defs";
|
||||
import { SammoAPI } from "@/SammoAPI";
|
||||
import { joinYearMonth } from "@/util/joinYearMonth";
|
||||
import { parseYearMonth } from "@/util/parseYearMonth";
|
||||
import { isString, range, sum } from "lodash";
|
||||
import { ref, type PropType, watch } from "vue";
|
||||
|
||||
type BettingDetailResponse = ValidResponse & {
|
||||
bettingInfo: BettingInfo;
|
||||
bettingDetail: [string, number][];
|
||||
myBetting: [string, number][];
|
||||
remainPoint: number;
|
||||
year: number;
|
||||
month: number;
|
||||
};
|
||||
|
||||
const props = defineProps({
|
||||
bettingID: {
|
||||
@@ -287,9 +279,7 @@ function calcReward() {
|
||||
|
||||
async function loadBetting(bettingID: number) {
|
||||
try {
|
||||
const result = await SammoAPI.Betting.GetBettingDetail<BettingDetailResponse>({
|
||||
betting_id: bettingID,
|
||||
});
|
||||
const result = await SammoAPI.Betting.GetBettingDetail[bettingID]();
|
||||
year.value = result.year;
|
||||
month.value = result.month;
|
||||
yearMonth.value = joinYearMonth(result.year, result.month);
|
||||
|
||||
Reference in New Issue
Block a user