Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
deleteProject: request2(async context => {
context.rootCommit("GlobalLoading/setVisible", true);
try {
await requestHelper(DeleteProject, {
id: context.rootState.diagram.projectDescription.id
});
message.success("Deleted", 2);
context.commit("setTitle", null);
context.commit("setDescription", null);
context.rootCommit("diagram/deletedData");
} catch (error) {
if (error.code === 10) {
message.error("Login first to delete this project", 2);
context.rootCommit("LeftPanel/setVisible", true);
context.rootCommit("LeftPanel/setPanelName", "login");
} else {
message.error(error.message, 2);
}
}
context.rootCommit("GlobalLoading/setVisible", false);
})
};
context.commit("setDiagram", dataJSON.diagram);
} else {
context.commit("setDiagram", {});
}
} else {
context.commit("setConnector", {});
context.commit("setDiagram", {});
}
document.title = respond.payload.title;
context.commit("setProjectDescription", respond.payload);
context.rootCommit("LeftDialog/FileMenu/Layout/setVisible", false);
context.rootCommit(
"LeftDialog/FileMenu/Layout/setPanelName",
"properties"
);
message.success("Opened", 2);
} catch (error) {
if (error.code === 23) {
message.info(error.description.title + " Required password", 3);
context.rootCommit(
"OpenSharedWithPassword/setUUID",
context.inputs.uuid
);
context.rootCommit("LeftDialog/FileMenu/Layout/setVisible", true);
context.rootCommit(
"LeftDialog/FileMenu/Layout/setPanelName",
"OpenSharedWithPassword"
);
} else {
message.error(error.message, 2);
}
createProject: request2(async context => {
context.commit("setLoding", true);
try {
var respond = await requestHelper(NewProject, {
title: context.state.title,
description: context.state.description
});
message.success("Created", 2);
context.commit("setTitle", "");
context.commit("setDescription", "");
context.rootDispatch("diagram/loadProject", {
id: respond.payload.id
});
} catch (error) {
if (error.code === 10) {
message.error("Login first to make new project", 2);
context.rootCommit("LeftPanel/setVisible", true);
context.rootCommit("LeftPanel/setPanelName", "login");
} else {
message.error(error.message, 2);
}
}
context.commit("setLoding", false);
})
saveChangeStatus: request2(async context => {
context.commit("setLoading", true);
try {
var shareStatusRespond = await requestHelper(SaveChangeShareStatus, {
id: context.rootState.Data.Project.projectDescription.id,
status: context.state.status,
password: context.state.sharePassword
});
var payload = shareStatusRespond.payload;
context.commit("setStatus", payload.share_status);
context.commit("setSharePassword", payload.share_password);
context.commit("setShareLink", payload.share_link);
message.success("Updated", 2);
} catch (error) {
if (error.code === 10) {
message.error("Login first to save share status", 2);
context.rootCommit("LeftDialog/FileMenu/Layout/setVisible", true);
context.rootCommit("LeftDialog/FileMenu/Layout/setPanelName", "login");
} else {
message.error(error.message, 2);
}
}
context.commit("setLoading", false);
}),
readShareStatus: request2(async context => {
createProject: request2(async context => {
context.commit("setLoding", true);
try {
var respond = await requestHelper(NewProject, {
title: context.state.title,
description: context.state.description
});
message.success("Created", 2);
context.commit("setTitle", "");
context.commit("setDescription", "");
context.rootDispatch("Data/Project/loadProject", {
id: respond.payload.id
});
} catch (error) {
if (error.code === 10) {
message.error("Login first to make new project", 2);
context.rootCommit("LeftDialog/FileMenu/Layout/setVisible", true);
context.rootCommit("LeftDialog/FileMenu/Layout/setPanelName", "login");
} else {
message.error(error.message, 2);
}
}
context.commit("setLoding", false);
})
doLogin: request2(async context => {
context.commit("setLoading", true);
try {
var respondAccount = await requestHelper(LoginAccount, {
email: context.state.email,
password: context.state.password
});
var payload = respondAccount.payload;
if (respondAccount.success === true) {
message.success("Login Success", 2);
context.rootCommit("LeftPanel/setPanelName", "open");
context.rootCommit("Account/setFullName", payload.complete_name);
context.rootCommit("Account/setGender", payload.gender);
context.rootCommit("Account/setUsername", payload.user_name);
context.rootCommit("Account/setEmail", payload.email);
context.rootCommit("Account/setId", payload.id);
context.rootCommit("Account/setVerified", payload.verified);
if (payload.verified === false) {
context.rootCommit("Account/setVisibleAccountInformation", true);
context.rootCommit(
"Account/setMessageAccountInformation",
"Your email need verify"
);
}else{
context.rootCommit("Account/setVisibleAccountInformation", false);
}
updateProject: request2(async context => {
context.commit("setLoding", true);
try {
await requestHelper(UpdateProject, {
id: context.rootState.diagram.projectDescription.id,
title: context.state.title,
description: context.state.description
});
message.success("Updated", 2);
context.rootDispatch("diagram/loadProject", {
id: context.rootState.diagram.projectDescription.id
});
} catch (error) {
if (error.code === 10) {
message.error("Login first to update this project", 2);
context.rootCommit("LeftPanel/setVisible", true);
context.rootCommit("LeftPanel/setPanelName", "login");
} else {
message.error(error.message, 2);
}
}
context.commit("setLoding", false);
}),
deleteProject: request2(async context => {
updateProject: request2(async context => {
context.commit("setLoding", true);
try {
await requestHelper(UpdateProject, {
id: context.rootState.Data.Project.projectDescription.id,
title: context.state.title,
description: context.state.description
});
message.success("Updated", 2);
context.rootDispatch("Data/Project/loadProject", {
id: context.rootState.Data.Project.projectDescription.id
});
context.rootCommit("LeftDialog/FileMenu/Layout/setVisible", false);
} catch (error) {
if (error.code === 10) {
message.error("Login first to update this project", 2);
context.rootCommit("LeftDialog/FileMenu/Layout/setVisible", true);
context.rootCommit("LeftDialog/FileMenu/Layout", "login");
} else {
message.error(error.message, 2);
}
}
context.commit("setLoding", false);
}),
deleteProject: request2(async context => {
changePassword: request2(async context => {
context.commit("setLoadingChangePassword", true);
try {
await requestHelper(ChangePassword, {
old_password: context.state.oldPassword,
new_password: context.state.newPassword,
confirm_new_password: context.state.confirmNewPassword
});
message.success("Updated", 2);
context.commit("setVisibleChangePassword", false);
} catch (error) {
if (error.code === 10) {
message.error("Login first to change password", 2);
context.rootCommit("LeftDialog/FileMenu/Layout/setVisible", true);
context.rootCommit("LeftDialog/FileMenu/Layout/setPanelName", "login");
} else {
message.error(error.message, 2);
}
}
context.commit("setLoadingChangePassword", false);
})
};
setTimeout(() => {
message.success("Saved Success", 1);
}, 500);
} catch (error) {