mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
50 lines
1.2 KiB
JavaScript
50 lines
1.2 KiB
JavaScript
import { createSelector } from '@reduxjs/toolkit';
|
|
|
|
const organizationSelector = (state, props) => state.organizations.data[props.organizationId];
|
|
|
|
export const getOrganizationByIdFactory = () => createSelector(
|
|
organizationSelector,
|
|
(organization) => organization
|
|
);
|
|
|
|
export const isOrganizationSeededFactory = () => createSelector(
|
|
organizationSelector,
|
|
(organization) => {
|
|
return !!organization?.seeded_at;
|
|
},
|
|
);
|
|
|
|
export const isOrganizationBuiltFactory = () => createSelector(
|
|
organizationSelector,
|
|
(organization) => {
|
|
return !!organization?.initialized_at;
|
|
},
|
|
);
|
|
|
|
export const isOrganizationInitializingFactory = () => createSelector(
|
|
organizationSelector,
|
|
(organization) => {
|
|
return organization?.is_initializing;
|
|
},
|
|
);
|
|
|
|
export const isOrganizationSeedingFactory = () => createSelector(
|
|
organizationSelector,
|
|
(organization) => {
|
|
return organization?.is_seeding;
|
|
},
|
|
);
|
|
|
|
export const isOrganizationReadyFactory = () => createSelector(
|
|
organizationSelector,
|
|
(organization) => {
|
|
return organization?.is_ready;
|
|
},
|
|
);
|
|
|
|
export const isOrganizationSubscribedFactory = () => createSelector(
|
|
organizationSelector,
|
|
(organization) => {
|
|
return organization?.subscriptions?.length > 0;
|
|
}
|
|
) |