rename method

This commit is contained in:
Zamitto 2024-06-16 22:19:36 -03:00
parent 63e74648c4
commit 16f862d389
4 changed files with 6 additions and 6 deletions

View File

@ -2,11 +2,11 @@ import { userAuthRepository } from "@main/repository";
import { registerEvent } from "../register-event";
import { HydraApi } from "@main/services/hydra-api";
const signout = async (_event: Electron.IpcMainInvokeEvent): Promise<void> => {
const signOut = async (_event: Electron.IpcMainInvokeEvent): Promise<void> => {
await Promise.all([
userAuthRepository.delete({ id: 1 }),
HydraApi.post("/auth/logout"),
]);
};
registerEvent("signout", signout);
registerEvent("signOut", signOut);

View File

@ -133,7 +133,7 @@ contextBridge.exposeInMainWorld("electron", {
getUser: (userId: string) => ipcRenderer.invoke("getUser", userId),
/* Auth */
signout: () => ipcRenderer.invoke("signout"),
signOut: () => ipcRenderer.invoke("signOut"),
onSignIn: (cb: () => void) => {
const listener = (_event: Electron.IpcRendererEvent) => cb();
ipcRenderer.on("on-signin", listener);

View File

@ -112,7 +112,7 @@ declare global {
restartAndInstallUpdate: () => Promise<void>;
/* Authg */
signout: () => Promise<void>;
signOut: () => Promise<void>;
onSignIn: (cb: () => void) => () => Electron.IpcRenderer;
onSignOut: (cb: () => void) => () => Electron.IpcRenderer;

View File

@ -5,13 +5,13 @@ import { setUserAuth } from "@renderer/features";
export function useUserAuth() {
const dispatch = useAppDispatch();
const [isLoading, setIsLoading] = useState(false);
const [isLoading, setIsLoading] = useState(true);
const { userAuth } = useAppSelector((state) => state.userAuth);
const signOut = useCallback(async () => {
dispatch(setUserAuth(null));
return window.electron.signout();
return window.electron.signOut();
}, [dispatch]);
const updateUserAuth = useCallback(async () => {