Skip to content

Commit

Permalink
refactor(web): services/api
Browse files Browse the repository at this point in the history
  • Loading branch information
KaWaite committed Jul 12, 2023
1 parent 65c1a14 commit 4ec0bc6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
11 changes: 5 additions & 6 deletions web/src/services/api/projectApi.ts
Expand Up @@ -50,7 +50,7 @@ export default () => {
},
});
if (projectErrors || !projectResults?.createProject) {
console.log("GraphQL: Failed to create project");
console.log("GraphQL: Failed to create project", projectErrors);
setNotification({ type: "error", text: t("Failed to create project.") });

return { status: "error" };
Expand All @@ -59,16 +59,15 @@ export default () => {
variables: { projectId: projectResults?.createProject.project.id },
});
if (sceneErrors) {
console.log("GraphQL: Failed to create scene for project creation.");
console.log("GraphQL: Failed to create scene for project creation.", sceneErrors);
setNotification({ type: "error", text: t("Failed to create project.") });

return { status: "error" };
}
}
return {
data: projectResults.createProject.project,
status: "success",
};

setNotification({ type: "success", text: t("Successfully created project!") });
return { data: projectResults.createProject.project, status: "success" };
},
[createNewProject, createScene, setNotification, t],
);
Expand Down
6 changes: 2 additions & 4 deletions web/src/services/api/workspacesApi.ts
Expand Up @@ -37,12 +37,10 @@ export default () => {
async (name: string): Promise<MutationReturn<Partial<Team>>> => {
const { data, errors } = await createWorkspaceMutation({ variables: { name } });
if (errors || !data?.createTeam) {
console.log("GraphQL: Failed to create workspace");
console.log("GraphQL: Failed to create workspace", errors);
setNotification({ type: "error", text: t("Failed to create workspace.") });

return {
status: "error",
};
return { status: "error" };
}

setNotification({ type: "success", text: t("Successfully created workspace!") });
Expand Down

0 comments on commit 4ec0bc6

Please sign in to comment.