更新页面
This commit is contained in:
73
src/views/consultation/sdk/login.ts
Normal file
73
src/views/consultation/sdk/login.ts
Normal file
@ -0,0 +1,73 @@
|
||||
export interface UserInfo {
|
||||
username: string;
|
||||
password: string;
|
||||
realm: string;
|
||||
webpucUrl: string;
|
||||
}
|
||||
|
||||
export default function useLoginModule() {
|
||||
/**
|
||||
* login
|
||||
* @returns
|
||||
*/
|
||||
const login = (userInfo: UserInfo) => {
|
||||
return window.lemon.login.login(userInfo);
|
||||
};
|
||||
|
||||
/**
|
||||
* logout
|
||||
* @returns
|
||||
*/
|
||||
const logout = () => {
|
||||
return window.lemon.login.logout();
|
||||
};
|
||||
|
||||
/**
|
||||
* get login account infomation
|
||||
* @returns
|
||||
*/
|
||||
const getLoginAccountInfo = () => {
|
||||
return window.lemon.login.getLoginAccountInfo();
|
||||
};
|
||||
|
||||
/**
|
||||
* Connect Websocket
|
||||
* @returns
|
||||
*/
|
||||
const reConnectWebsocket = (reConnectInfo) => {
|
||||
return window.lemon.login.reConnectWebsocket(reConnectInfo);
|
||||
};
|
||||
|
||||
/**
|
||||
* get the account login status
|
||||
* @returns ture is login in, false is not logged in
|
||||
*/
|
||||
const isLogin = () => {
|
||||
return window.lemon.login.isLogin();
|
||||
};
|
||||
|
||||
/**
|
||||
* add login status change listener
|
||||
* @returns callbackid
|
||||
*/
|
||||
const addLoginStatusChangeListener = (onLoginStatusChange) => {
|
||||
return window.lemon.login.addLoginStatusChangeListener(onLoginStatusChange);
|
||||
};
|
||||
|
||||
/**
|
||||
* remove login status change listener
|
||||
*/
|
||||
const removeLoginStatusChangeListener = (loginStatusGuid: string) => {
|
||||
window.lemon.login.removeLoginStatusChangeListener(loginStatusGuid);
|
||||
};
|
||||
|
||||
return {
|
||||
login,
|
||||
logout,
|
||||
reConnectWebsocket,
|
||||
getLoginAccountInfo,
|
||||
isLogin,
|
||||
addLoginStatusChangeListener,
|
||||
removeLoginStatusChangeListener,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user