master
Drfelfel 2021-09-26 14:54:26 +03:30
parent 7e1a32e521
commit 91f88bdf5d
3 changed files with 32 additions and 11 deletions

View File

@ -334,15 +334,15 @@ export class RayconnectSdk extends RayconnectBase {
}
async loadProfile() {
const api = `https://s1.iranserver1.rayconnect.ir/api/v2/me?aid=${this.ops.appID}&token=${await this.getPrivateAuthToken()}`
const api = `https://s1.iranserver1.rayconnect.ir/api/v2/me?aid=${this.ops.appID}&token=${await this.getPrivateAuthToken()}`
const result = await fetch(api);
const result = await fetch(api);
const me_user = await result.json();
const me_user = await result.json();
this.user = me_user
this.user = me_user
}
async RequestBack(execObj: ExecuteType, TimeOutNumber = 30000) {
const m_id = this.getMessageID();
@ -591,6 +591,23 @@ export class RayconnectSdk extends RayconnectBase {
});
}
RegisterUser(param: {
email: string,
password: string,
phone?: string
}) {
return emitDataWithTimeout(this.socket, {
key: "register_email",
response_key: "register_email",
value: param,
});
}
requestDataConvertor(request: any) {
let data = {};

View File

@ -18,4 +18,4 @@ declare global {
window.Rayconnect = Rayconnect
window.RayconnectInit = RayApp
window.RayconnectInit = RayApp

View File

@ -57,16 +57,20 @@ class Rayconnect extends RayconnectSdk {
verify: this.VerifyPhone,
getCode: this.RequestOTP
},
signIn: (username: string, password: string) => {
signIn: (email: string, password: string) => {
return this.LoginWithPassword({
username,
username: email,
password
})
},
signUp: (email: string, username: string, password: string) => {
signUp: (email: string, password: string, phone:string) => {
return this.RegisterUser({
email: email,
password,
phone
})
},
signOut: () => {
@ -250,4 +254,4 @@ class Rayconnect extends RayconnectSdk {
// export rayconnect
export default Rayconnect
export default Rayconnect