@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
19 lines • 754 B
JavaScript
import { useCallback } from "react";
import { useReplykeDispatch } from "../../store/hooks";
import { signOutAllThunk } from "../../store/slices/authThunks";
import useProject from "../projects/useProject";
export default function useSignOutAll() {
const dispatch = useReplykeDispatch();
const { projectId } = useProject();
const signOutAll = useCallback(async () => {
if (!projectId) {
throw new Error("No projectId available.");
}
const result = await dispatch(signOutAllThunk({ projectId }));
if (signOutAllThunk.rejected.match(result)) {
throw new Error(result.payload);
}
}, [dispatch, projectId]);
return { signOutAll };
}
//# sourceMappingURL=useSignOutAll.js.map