beginnings of refactor

This commit is contained in:
Andrew Gundersen 2021-06-08 21:21:11 -05:00
commit 3b5da6124f
63 changed files with 1697 additions and 2656 deletions

52
src/render/ipc.ts Normal file
View file

@ -0,0 +1,52 @@
import useIpc from "@/render/composables/ipc";
const { post, invoke } = useIpc();
/**
*
* Account and auth related endpoints
*
*/
export const invokeProfile = async (): Promise<Profile | Error> => (
await invoke('user-profile', null)
);
export const invokeLogin = async (
payload: LoginPayload
): Promise<Profile | Error> => (
await invoke('user-login', JSON.stringify(payload))
);
export const invokeLogout = async (): Promise<void> => (
await invoke("user-logout", null)
);
/**
*
* Audio endpoints
*
*/
export const postAudioChunk = (chunk: ArrayBuffer): void => (
post("audio-chunk", chunk)
);
export const invokeReturnAudio = async (): Promise<ArrayBuffer[] | Error> => (
await invoke("get-audio", null)
);
/**
*
* Crimata Platform (session) endpoints
*
*/
export const invokeSession = async (cid: string): Promise<Profile | Error> => (
await invoke("messenger-init", cid)
);
export const postMessage = (payload: Message): void => (
post('client-message', payload)
);