- 토너먼트 베팅을 betting 테이블 대신 Betting 모듈을 이용하는 형태로 변경 - 이전 토너먼트 베팅 기록이 남음 - 현재 이전 토너먼트 기록을 볼 수는 없음 - 베팅에 API/Betting/Bet 을 이용 - 토너먼트, 베팅 페이지를 Betting 모듈에 맞게 임시 조정 - 이전 버전과의 호환성을 위해 betting table과 betting 테이블에 초기값을 추가하는 로직은 남김 - 이후 0.30이 되었을 때 제거 Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/218
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import $ from 'jquery';
|
|
import axios from 'axios';
|
|
import { setAxiosXMLHttpRequest } from '@util/setAxiosXMLHttpRequest';
|
|
import type { InvalidResponse } from '@/defs';
|
|
import { convertFormData } from '@util/convertFormData';
|
|
import { unwrap_any } from '@util/unwrap_any';
|
|
import { SammoAPI } from './SammoAPI';
|
|
|
|
declare const staticValues: {
|
|
bettingID: number;
|
|
}
|
|
|
|
$(function ($) {
|
|
$('.submitBtn').on('click', async function (e) {
|
|
e.preventDefault();
|
|
|
|
const $this = $(this);
|
|
const target = parseInt($this.data('target'));
|
|
const amount = parseInt(unwrap_any<string>($(`#target_${target}`).val()));
|
|
|
|
try {
|
|
await SammoAPI.Betting.Bet({
|
|
bettingID: staticValues.bettingID,
|
|
bettingType: [target],
|
|
amount: amount,
|
|
});
|
|
} catch (e) {
|
|
console.error(e);
|
|
alert(`베팅을 실패했습니다: ${e}`);
|
|
location.reload();
|
|
return;
|
|
}
|
|
|
|
location.reload();
|
|
return;
|
|
});
|
|
}); |