diff --git a/apps/fishing-map/features/workspace/workspace.slice.ts b/apps/fishing-map/features/workspace/workspace.slice.ts index 607f58a4fd..333911845c 100644 --- a/apps/fishing-map/features/workspace/workspace.slice.ts +++ b/apps/fishing-map/features/workspace/workspace.slice.ts @@ -317,7 +317,7 @@ export const saveWorkspaceThunk = createAsyncThunk( const saveWorkspace = async (tries = 0): Promise | undefined> => { let workspaceUpdated - if (tries < 2) { + if (tries < 4) { try { const name = tries > 0 ? defaultName + `_${tries}` : defaultName workspaceUpdated = await GFWAPI.fetch>(`/workspaces`, { @@ -338,7 +338,7 @@ export const saveWorkspaceThunk = createAsyncThunk( } as FetchOptions>) } catch (e: any) { // Means we already have a workspace with this name - if (e.status === 400) { + if (e.status === 422 && e.message.includes('duplicated')) { return await saveWorkspace(tries + 1) } console.warn('Error creating workspace', e)