fix: bootstrap5 modal
This commit is contained in:
@@ -9,6 +9,7 @@ import { numberWithCommas } from "@util/numberWithCommas";
|
|||||||
import { unwrap_any } from '@util/unwrap_any';
|
import { unwrap_any } from '@util/unwrap_any';
|
||||||
import { BasicGeneralListResponse, InvalidResponse } from '@/defs';
|
import { BasicGeneralListResponse, InvalidResponse } from '@/defs';
|
||||||
import { formatTime } from '@util/formatTime';
|
import { formatTime } from '@util/formatTime';
|
||||||
|
import { Modal } from 'bootstrap';
|
||||||
|
|
||||||
type CityAttackerInfo = {
|
type CityAttackerInfo = {
|
||||||
level: number,
|
level: number,
|
||||||
@@ -222,7 +223,7 @@ $(function ($) {
|
|||||||
|
|
||||||
const $modal = $('#importModal');
|
const $modal = $('#importModal');
|
||||||
$modal.data('target', $card);
|
$modal.data('target', $card);
|
||||||
$modal.modal('show');
|
new Modal($modal[0]).show();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.btn-general-save').on('click', function () {
|
$('.btn-general-save').on('click', function () {
|
||||||
@@ -959,7 +960,7 @@ $(function ($) {
|
|||||||
const $card = $modal.data('target');
|
const $card = $modal.data('target');
|
||||||
importGeneralInfo($card, data.general);
|
importGeneralInfo($card, data.general);
|
||||||
|
|
||||||
$modal.modal('hide');
|
new Modal($modal[0]).hide();
|
||||||
}, errUnknown);
|
}, errUnknown);
|
||||||
|
|
||||||
|
|
||||||
@@ -1008,7 +1009,7 @@ $(function ($) {
|
|||||||
}).then(function (data: BasicGeneralListResponse | InvalidResponse) {
|
}).then(function (data: BasicGeneralListResponse | InvalidResponse) {
|
||||||
if (!data.result) {
|
if (!data.result) {
|
||||||
alert(data.reason);
|
alert(data.reason);
|
||||||
$('#importModal').modal('hide');
|
new Modal(unwrap(document.querySelector('#importModal'))).hide();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+27
-21
@@ -54,7 +54,7 @@ declare global {
|
|||||||
declare const kakao_oauth_client_id: string;
|
declare const kakao_oauth_client_id: string;
|
||||||
declare const kakao_oauth_redirect_uri: string;
|
declare const kakao_oauth_redirect_uri: string;
|
||||||
|
|
||||||
let modalOTP: Modal|undefined = undefined;
|
let modalOTP: Modal | undefined = undefined;
|
||||||
|
|
||||||
let oauthMode: string | null = null;
|
let oauthMode: string | null = null;
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ function getToken(): [number, string] | undefined {
|
|||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetToken(){
|
function resetToken() {
|
||||||
localStorage.removeItem(LOGIN_TOKEN_KEY);
|
localStorage.removeItem(LOGIN_TOKEN_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,12 +96,12 @@ async function tryAutoLogin() {
|
|||||||
path: ["Login", "ReqNonce"]
|
path: ["Login", "ReqNonce"]
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!result){
|
if (!result) {
|
||||||
//api 에러.
|
//api 에러.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!result.data.result){
|
if (!result.data.result) {
|
||||||
resetToken();
|
resetToken();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -112,31 +112,31 @@ async function tryAutoLogin() {
|
|||||||
const _loginResult = await axios.post<AutoLoginResponse>('api.php', {
|
const _loginResult = await axios.post<AutoLoginResponse>('api.php', {
|
||||||
path: ["Login", "LoginByToken"],
|
path: ["Login", "LoginByToken"],
|
||||||
args: {
|
args: {
|
||||||
'hashedToken':hashedToken,
|
'hashedToken': hashedToken,
|
||||||
'token_id':tokenID,
|
'token_id': tokenID,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!_loginResult){
|
if (!_loginResult) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const loginResult = _loginResult.data;
|
const loginResult = _loginResult.data;
|
||||||
if(!loginResult.result){
|
if (!loginResult.result) {
|
||||||
if(!loginResult.silent){
|
if (!loginResult.silent) {
|
||||||
alert(loginResult.reason);
|
alert(loginResult.reason);
|
||||||
}
|
}
|
||||||
console.error(loginResult.reason);
|
console.error(loginResult.reason);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(loginResult.nextToken){
|
if (loginResult.nextToken) {
|
||||||
regNextToken(loginResult.nextToken);
|
regNextToken(loginResult.nextToken);
|
||||||
}
|
}
|
||||||
window.location.href = "./";
|
window.location.href = "./";
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(e){
|
catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -231,10 +231,12 @@ async function doLoginUsingOAuth() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const modalEl = unwrap(document.querySelector('#modalOTP'))
|
const modalEl = unwrap(document.querySelector('#modalOTP'))
|
||||||
modalOTP = new Modal(modalEl);
|
if (!modalOTP) {
|
||||||
modalEl.addEventListener('shown.bs.modal', function(){
|
modalOTP = new Modal(modalEl);
|
||||||
$('#otp_code').trigger('focus');
|
modalEl.addEventListener('shown.bs.modal', function () {
|
||||||
});
|
unwrap(document.querySelector<HTMLElement>('#otp_code')).focus();
|
||||||
|
});
|
||||||
|
}
|
||||||
modalOTP.show();
|
modalOTP.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,7 +270,7 @@ $(async function ($) {
|
|||||||
setAxiosXMLHttpRequest();
|
setAxiosXMLHttpRequest();
|
||||||
|
|
||||||
//로그인 먼저 해볼 것
|
//로그인 먼저 해볼 것
|
||||||
if(getToken()){
|
if (getToken()) {
|
||||||
void tryAutoLogin();
|
void tryAutoLogin();
|
||||||
await delay(100);
|
await delay(100);
|
||||||
}
|
}
|
||||||
@@ -342,10 +344,14 @@ $(async function ($) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const $modal = $('#modalOTP').modal() as unknown as JQuery;
|
const modalEl = unwrap(document.querySelector('#modalOTP'))
|
||||||
$modal.on('shown.bs.modal', function () {
|
if (!modalOTP) {
|
||||||
$('#otp_code').trigger('focus');
|
modalOTP = new Modal(modalEl);
|
||||||
});
|
modalEl.addEventListener('shown.bs.modal', function () {
|
||||||
|
unwrap(document.querySelector<HTMLElement>('#otp_code')).focus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
modalOTP.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#otp_form').on('submit', async function (e) {
|
$('#otp_form').on('submit', async function (e) {
|
||||||
@@ -379,7 +385,7 @@ $(async function ($) {
|
|||||||
alert(result.reason);
|
alert(result.reason);
|
||||||
|
|
||||||
if (result.reset) {
|
if (result.reset) {
|
||||||
if(modalOTP){
|
if (modalOTP) {
|
||||||
modalOTP.hide();
|
modalOTP.hide();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { unwrap } from '@util/unwrap';
|
|||||||
import { parseTime } from '@util/parseTime';
|
import { parseTime } from '@util/parseTime';
|
||||||
import { formatTime } from '@util/formatTime';
|
import { formatTime } from '@util/formatTime';
|
||||||
import '@/gateway/common';
|
import '@/gateway/common';
|
||||||
|
import { Modal } from 'bootstrap';
|
||||||
|
|
||||||
type ResultUserInfo = {
|
type ResultUserInfo = {
|
||||||
result: true,
|
result: true,
|
||||||
@@ -128,14 +129,14 @@ function showAdjustServerModal(serverList: [string, string][]) {
|
|||||||
$form.append($item);
|
$form.append($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
const $modal = $('#chooseServer');
|
const modalEl = unwrap(document.querySelector('#chooseServer'));
|
||||||
$modal.modal({
|
new Modal(modalEl, {
|
||||||
backdrop: 'static'
|
backdrop: 'static'
|
||||||
});
|
});
|
||||||
$modal.on('hidden.bs.modal', function () {
|
modalEl.addEventListener('hidden.bs.modal', function () {
|
||||||
location.reload();
|
location.reload();
|
||||||
return;
|
return;
|
||||||
});
|
})
|
||||||
|
|
||||||
$("#modal-apply").off("click").on("click", async function () {
|
$("#modal-apply").off("click").on("click", async function () {
|
||||||
const events: Promise<unknown>[] = [];
|
const events: Promise<unknown>[] = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user