@r3l/app
Version:
31 lines (24 loc) • 853 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.usePostUrl = exports.usePostComunity = void 0;
var _reactRedux = require("react-redux");
var _post = require("../../utils/post");
var usePostComunity = function usePostComunity(post) {
var currentCommunity = (0, _reactRedux.useSelector)(function (state) {
return state.auth.community;
});
var postCommunity = post && post.data && post.data.community;
var community = postCommunity || currentCommunity;
return community;
};
exports.usePostComunity = usePostComunity;
var usePostUrl = function usePostUrl(post) {
var community = usePostComunity(post);
var parentPost = post.parentPost || post;
var postUrl = (0, _post.getPostUrl)(community, parentPost);
return postUrl;
};
exports.usePostUrl = usePostUrl;
//# sourceMappingURL=hooks.js.map