forked from github/plane
fix: cycle and module create/update modal fix (#2833)
This commit is contained in:
parent
e6a1f34713
commit
dd8c7a7487
@ -30,9 +30,11 @@ export const CycleCreateUpdateModal: React.FC<CycleModalProps> = (props) => {
|
|||||||
// toast
|
// toast
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
|
|
||||||
const createCycle = async (payload: Partial<ICycle>) =>
|
const createCycle = async (payload: Partial<ICycle>) => {
|
||||||
cycleStore
|
if (!workspaceSlug || !projectId) return;
|
||||||
.createCycle(workspaceSlug, projectId, payload)
|
const selectedProjectId = payload.project ?? projectId.toString();
|
||||||
|
await cycleStore
|
||||||
|
.createCycle(workspaceSlug, selectedProjectId, payload)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "success",
|
type: "success",
|
||||||
@ -47,10 +49,13 @@ export const CycleCreateUpdateModal: React.FC<CycleModalProps> = (props) => {
|
|||||||
message: "Error in creating cycle. Please try again.",
|
message: "Error in creating cycle. Please try again.",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const updateCycle = async (cycleId: string, payload: Partial<ICycle>) =>
|
const updateCycle = async (cycleId: string, payload: Partial<ICycle>) => {
|
||||||
cycleStore
|
if (!workspaceSlug || !projectId) return;
|
||||||
.patchCycle(workspaceSlug, projectId, cycleId, payload)
|
const selectedProjectId = payload.project ?? projectId.toString();
|
||||||
|
await cycleStore
|
||||||
|
.patchCycle(workspaceSlug, selectedProjectId, cycleId, payload)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setToastAlert({
|
setToastAlert({
|
||||||
type: "success",
|
type: "success",
|
||||||
@ -65,6 +70,7 @@ export const CycleCreateUpdateModal: React.FC<CycleModalProps> = (props) => {
|
|||||||
message: "Error in updating cycle. Please try again.",
|
message: "Error in updating cycle. Please try again.",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const dateChecker = async (payload: CycleDateCheckData) => {
|
const dateChecker = async (payload: CycleDateCheckData) => {
|
||||||
let status = false;
|
let status = false;
|
||||||
|
@ -49,9 +49,9 @@ export const CreateUpdateModuleModal: React.FC<Props> = observer((props) => {
|
|||||||
|
|
||||||
const createModule = async (payload: Partial<IModule>) => {
|
const createModule = async (payload: Partial<IModule>) => {
|
||||||
if (!workspaceSlug || !projectId) return;
|
if (!workspaceSlug || !projectId) return;
|
||||||
|
const selectedProjectId = payload.project ?? projectId.toString();
|
||||||
await moduleStore
|
await moduleStore
|
||||||
.createModule(workspaceSlug.toString(), projectId.toString(), payload)
|
.createModule(workspaceSlug.toString(), selectedProjectId, payload)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
handleClose();
|
handleClose();
|
||||||
|
|
||||||
@ -72,9 +72,9 @@ export const CreateUpdateModuleModal: React.FC<Props> = observer((props) => {
|
|||||||
|
|
||||||
const updateModule = async (payload: Partial<IModule>) => {
|
const updateModule = async (payload: Partial<IModule>) => {
|
||||||
if (!workspaceSlug || !projectId || !data) return;
|
if (!workspaceSlug || !projectId || !data) return;
|
||||||
|
const selectedProjectId = payload.project ?? projectId.toString();
|
||||||
await moduleStore
|
await moduleStore
|
||||||
.updateModuleDetails(workspaceSlug.toString(), projectId.toString(), data.id, payload)
|
.updateModuleDetails(workspaceSlug.toString(), selectedProjectId, data.id, payload)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
handleClose();
|
handleClose();
|
||||||
|
|
||||||
@ -99,7 +99,6 @@ export const CreateUpdateModuleModal: React.FC<Props> = observer((props) => {
|
|||||||
const payload: Partial<IModule> = {
|
const payload: Partial<IModule> = {
|
||||||
...formData,
|
...formData,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!data) await createModule(payload);
|
if (!data) await createModule(payload);
|
||||||
else await updateModule(payload);
|
else await updateModule(payload);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user