Skip to content

Commit

Permalink
Merge pull request #4701 from 3drepo/ISSUE_4645
Browse files Browse the repository at this point in the history
ISSUE #4645 - Fix of project image when creating the project
  • Loading branch information
carmenfan authored Jan 19, 2024
2 parents d5669aa + 0b58301 commit e6728b2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions frontend/src/v5/store/projects/projects.sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,27 @@ 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,
};
yield put(ProjectsActions.createProjectSuccess(teamspace, newProject));


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 e6728b2

Please sign in to comment.