51 lines
1002 B
TypeScript
51 lines
1002 B
TypeScript
|
|
||
|
import { type AxiosResponse } from "axios";
|
||
|
import { service as instance } from "../utils/api/request.js";
|
||
|
import { API_URL } from "../utils/api/config.js";
|
||
|
// import { login, loginCaller, type LoginCallerInfo } from "../utils/account.js";
|
||
|
|
||
|
interface LoginInfo
|
||
|
{
|
||
|
p13account: string;
|
||
|
password: string;
|
||
|
}
|
||
|
|
||
|
interface LoginCallerInfo
|
||
|
{
|
||
|
telsaler_code: string;
|
||
|
}
|
||
|
|
||
|
async function loginCaller( data: LoginCallerInfo ): Promise<AxiosResponse<any, any>>
|
||
|
{
|
||
|
return await instance.request(
|
||
|
{
|
||
|
method: "post",
|
||
|
url: API_URL.URL_LOGIN_CALLER,
|
||
|
data,
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function loginTestCaller(): void
|
||
|
{
|
||
|
const info: LoginCallerInfo =
|
||
|
{
|
||
|
telsaler_code: "61136",
|
||
|
};
|
||
|
|
||
|
loginCaller( info )
|
||
|
.then(( response ) =>
|
||
|
{
|
||
|
console.log( response.data );
|
||
|
})
|
||
|
.catch(( error ) =>
|
||
|
{
|
||
|
console.log( error );
|
||
|
});
|
||
|
}
|
||
|
|
||
|
export {
|
||
|
loginTestCaller,
|
||
|
type LoginInfo,
|
||
|
type LoginCallerInfo
|
||
|
};
|