How to handle a user deleting its current workspace?
I have two main routes /projects
(where the user sees a list of its own projects and can create and delete multiple projects) and /project/:id
(where the user can manage its current project).
A user always has a current project. When a user log in, the app loads its current project (or latest project in use) from the database and store it in the application state.
Let’s say a user has 3 projects A, B and C. Its current project is project B. On /projects
The user creates a new project D and on submit:
- project D is created
- project D becomes the current project
- the user is redirected to
/project/D
Now let’s say a user’s current project is B and it deletes it.
- How should I reassign a current project to the user? Is there a best practice? Should it be randomly reassigned?
- where the user should he redirected since the current project doesn't exist anymore?
It’s like deleting the workspace you’re operating on. You can’t be on that workspace anymore but you can’t operate in a vacuum.