mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
feat: setup congrats page.
This commit is contained in:
@@ -36,17 +36,29 @@ export const seedTenant = () => (dispatch, getState) => new Promise((resolve, re
|
||||
const organizationId = getState().authentication.organizationId;
|
||||
|
||||
dispatch({
|
||||
type: t.SET_ORGANIZATION_INITIALIZING,
|
||||
type: t.SET_ORGANIZATION_SEEDING,
|
||||
payload: { organizationId }
|
||||
});
|
||||
ApiService.post(`organization/seed/`).then((response) => {
|
||||
resolve(response);
|
||||
dispatch({
|
||||
type: t.SET_ORGANIZATION_INITIALIZED,
|
||||
type: t.SET_ORGANIZATION_SEEDED,
|
||||
payload: { organizationId }
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error.response.data.errors || []);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
export const setOrganizationSetupCompleted = (congrats) => (dispatch, getState) => {
|
||||
const organizationId = getState().authentication.organizationId;
|
||||
|
||||
dispatch({
|
||||
type: t.SET_ORGANIZATION_CONGRATS,
|
||||
payload: {
|
||||
organizationId,
|
||||
congrats
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -37,6 +37,7 @@ const reducer = createReducer(initialState, {
|
||||
...(state.data[organizationId] || {}),
|
||||
is_seeding: false,
|
||||
seeded_at: new Date().toISOString(),
|
||||
is_ready: true,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -58,6 +59,15 @@ const reducer = createReducer(initialState, {
|
||||
initialized_at: new Date().toISOString(),
|
||||
};
|
||||
},
|
||||
|
||||
[t.SET_ORGANIZATION_CONGRATS]: (state, action) => {
|
||||
const { organizationId, congrats } = action.payload;
|
||||
|
||||
state.data[organizationId] = {
|
||||
...(state.data[organizationId] || {}),
|
||||
is_congrats: !!congrats,
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
export default reducer;
|
||||
@@ -47,4 +47,11 @@ export const isOrganizationSubscribedFactory = () => createSelector(
|
||||
(organization) => {
|
||||
return organization?.subscriptions?.length > 0;
|
||||
}
|
||||
);
|
||||
|
||||
export const isOrganizationCongratsFactory = () => createSelector(
|
||||
organizationSelector,
|
||||
(organization) => {
|
||||
return !!organization?.is_congrats;
|
||||
}
|
||||
)
|
||||
@@ -7,4 +7,6 @@ export default {
|
||||
|
||||
SET_ORGANIZATION_INITIALIZED: 'SET_ORGANIZATION_INITIALIZED',
|
||||
SET_ORGANIZATION_INITIALIZING: 'SET_ORGANIZATION_INITIALIZING',
|
||||
|
||||
SET_ORGANIZATION_CONGRATS: 'SET_ORGANIZATION_CONGRATS'
|
||||
};
|
||||
Reference in New Issue
Block a user