升级ts代码。
This commit is contained in:
50
code/web/task_schedule/src/test/requestTest.ts
Normal file
50
code/web/task_schedule/src/test/requestTest.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
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
|
||||
};
|
Reference in New Issue
Block a user