Add Login API(#20)

This commit is contained in:
2022-01-12 15:24:59 +08:00
parent 478eafa4a3
commit 4f83dd6822
3 changed files with 179 additions and 44 deletions
+7 -38
View File
@@ -1,5 +1,5 @@
import { Modular, Manager, ILifetime } from "../../core/Module";
import { API, IParamSetting } from "../../core/Api";
import { Login } from "../../api/Login";
import { Storage } from "../../core/Storage";
/**
@@ -27,44 +27,13 @@ implements Partial<ILifetime> {
setTimeout(() => {
s.set("be", 12);
}, 1000)
interface ITestApiInput {
name: string,
id: number,
info: {
data: string
}
}
class TestApi extends API<ITestApiInput, {}> {
public override params: IParamSetting<ITestApiInput> = {
name: {
tester: "123",
isHeader: true
},
id: {
parse: (i) => ++i,
},
info: {}
}
public constructor() {
super();
this.initDebugLabel("TestApi");
}
}
let api = new TestApi();
api.param({
name: "123",
id: 456,
info: {
data: "abc"
}
}).request().waitRequest({
success: (d) => console.log(d)
})
new Login().param({studentId: "1806240113", password: "qazxsw123"})
.request().wait({
ok: (w) => {console.log("ok", w)},
no: (w) => {console.log("no", w)},
done: (w) => {console.log("done", w)}
});
}
}