mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
minor cleanup
This commit is contained in:
parent
aeffbf1063
commit
75dbab6778
@ -30,34 +30,22 @@ export function useAppContext() {
|
||||
available: getAvailable,
|
||||
username: getUsername,
|
||||
create: async (username, password, token) => {
|
||||
await appCreate(username, password, token)
|
||||
const acc = username.split('@');
|
||||
await addAccount(acc[0], acc[1], password, token);
|
||||
const access = await setLogin(acc[0], acc[1], password)
|
||||
store.actions.setSession({ ...access, server: acc[1] });
|
||||
},
|
||||
login: async (username, password) => {
|
||||
await appLogin(username, password)
|
||||
const acc = username.split('@');
|
||||
const access = await setLogin(acc[0], acc[1], password)
|
||||
store.actions.setSession({ ...access, server: acc[1] });
|
||||
},
|
||||
logout: () => {
|
||||
appLogout();
|
||||
logout: async () => {
|
||||
resetData();
|
||||
await store.actions.clearSession();
|
||||
},
|
||||
}
|
||||
|
||||
const appCreate = async (username, password, token) => {
|
||||
const acc = username.split('@');
|
||||
await addAccount(acc[0], acc[1], password, token);
|
||||
const access = await setLogin(acc[0], acc[1], password)
|
||||
store.actions.setSession({ ...access, server: acc[1] });
|
||||
}
|
||||
|
||||
const appLogin = async (username, password) => {
|
||||
const acc = username.split('@');
|
||||
const access = await setLogin(acc[0], acc[1], password)
|
||||
store.actions.setSession({ ...access, server: acc[1] });
|
||||
}
|
||||
|
||||
const appLogout = () => {
|
||||
store.actions.clearSession();
|
||||
}
|
||||
|
||||
const setWebsocket = (server, token) => {
|
||||
clearWebsocket();
|
||||
ws.current = new WebSocket(`wss://${server}/status`);
|
||||
|
Loading…
Reference in New Issue
Block a user