Skip to content

Commit

Permalink
ISSUE #4645 - In case the image upload fails when creating a project …
Browse files Browse the repository at this point in the history
…it still creates the project (just with no image)
  • Loading branch information
sanmont3drepo committed Jan 18, 2024
1 parent 3988c96 commit 0b58301
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions frontend/src/v5/store/projects/projects.sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ function * updateImage({ teamspace, projectId, image }) {
export function* createProject({ teamspace, project, onSuccess, onImageError, onError }) {
const { name, image } = project;
let projectId;
let newProject;
try {
projectId = yield API.Projects.createProject(teamspace, name);

const newProject = {
newProject = {
_id: projectId,
name,
isAdmin: true,
Expand All @@ -59,12 +60,14 @@ export function* createProject({ teamspace, project, onSuccess, onImageError, on
if (image) {
yield updateImage({ teamspace, projectId, image });
}

yield put(ProjectsActions.createProjectSuccess(teamspace, newProject));

onSuccess();
} catch (error) {
if (projectId) {
onImageError(error, projectId);
yield put(ProjectsActions.createProjectSuccess(teamspace, newProject));
} else {
onError(error);
}
Expand Down

0 comments on commit 0b58301

Please sign in to comment.