UNPKG

@replyke/core

Version:

Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.

25 lines 1.07 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = useSignOutAll; const react_1 = require("react"); const hooks_1 = require("../../store/hooks"); const authThunks_1 = require("../../store/slices/authThunks"); const useProject_1 = __importDefault(require("../projects/useProject")); function useSignOutAll() { const dispatch = (0, hooks_1.useReplykeDispatch)(); const { projectId } = (0, useProject_1.default)(); const signOutAll = (0, react_1.useCallback)(async () => { if (!projectId) { throw new Error("No projectId available."); } const result = await dispatch((0, authThunks_1.signOutAllThunk)({ projectId })); if (authThunks_1.signOutAllThunk.rejected.match(result)) { throw new Error(result.payload); } }, [dispatch, projectId]); return { signOutAll }; } //# sourceMappingURL=useSignOutAll.js.map