login을 API로 이동
This commit is contained in:
@@ -357,31 +357,6 @@ function buildNationCommandClass(?string $type, General $generalObj, array $env,
|
||||
return new $class($generalObj, $env, $lastTurn, $arg);
|
||||
}
|
||||
|
||||
function getAPIExecutorClass($path){
|
||||
|
||||
static $basePath = __NAMESPACE__.'\\API\\';
|
||||
if(is_string($path)){
|
||||
}
|
||||
else if(is_array($path)){
|
||||
$path = join('\\', $path);
|
||||
}
|
||||
else{
|
||||
throw new \InvalidArgumentException("{$path}는 올바른 API 지시자가 아님");
|
||||
}
|
||||
|
||||
$classPath = str_replace('/', '\\', $basePath.$path);
|
||||
|
||||
if(class_exists($classPath)){
|
||||
return $classPath;
|
||||
}
|
||||
throw new \InvalidArgumentException("{$path}는 올바른 API 경로가 아님");
|
||||
}
|
||||
|
||||
function buildAPIExecutorClass($type, string $rootPath, array $args):\sammo\BaseAPI{
|
||||
$class = getAPIExecutorClass($type);
|
||||
return new $class($rootPath, $args);
|
||||
}
|
||||
|
||||
function getWarUnitTriggerClass(string $type){
|
||||
static $basePath = __NAMESPACE__.'\\WarUnitTrigger\\';
|
||||
$classPath = ($basePath.$type);
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace sammo;
|
||||
|
||||
abstract class BaseAPI
|
||||
{
|
||||
const NO_SESSION = 0;
|
||||
const REQ_LOGIN = 1;
|
||||
const REQ_GAME_LOGIN = 2;
|
||||
const REQ_READ_ONLY = 4;
|
||||
|
||||
protected array $args;
|
||||
protected string $rootPath;
|
||||
public function __construct(string $rootPath, array $args)
|
||||
{
|
||||
$this->rootPath = $rootPath;
|
||||
$this->args = $args;
|
||||
}
|
||||
abstract public function getRequiredSessionMode(): int;
|
||||
abstract function validateArgs(): ?string;
|
||||
|
||||
/** @return null|string|array */
|
||||
abstract function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag);
|
||||
|
||||
public function tryCache():?string{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+11
-8
@@ -1,7 +1,7 @@
|
||||
import $ from 'jquery';
|
||||
import 'popper.js';
|
||||
import Popper from 'popper.js';
|
||||
(window as unknown as {Popper:unknown}).Popper = Popper;
|
||||
(window as unknown as { Popper: unknown }).Popper = Popper;
|
||||
import 'bootstrap';
|
||||
import { JQValidateForm, NamedRules } from '../util/jqValidateForm';
|
||||
import axios from 'axios';
|
||||
@@ -194,13 +194,16 @@ $(function ($) {
|
||||
|
||||
try {
|
||||
const response = await axios({
|
||||
url: 'j_login.php',
|
||||
url: 'api.php',
|
||||
responseType: 'json',
|
||||
method: 'post',
|
||||
data: convertFormData({
|
||||
username: values.username,
|
||||
password: hash_pw,
|
||||
})
|
||||
data: {
|
||||
path: ["Login", "LoginByID"],
|
||||
args: {
|
||||
username: values.username,
|
||||
password: hash_pw,
|
||||
}
|
||||
}
|
||||
});
|
||||
result = response.data;
|
||||
}
|
||||
@@ -268,9 +271,9 @@ $(function ($) {
|
||||
getOAuthToken('change_pw', 'talk_message');
|
||||
});
|
||||
|
||||
$('#btn_kakao_login').on('click', function(e){
|
||||
$('#btn_kakao_login').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
getOAuthToken('login', ['account_email','talk_message']);
|
||||
getOAuthToken('login', ['account_email', 'talk_message']);
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user