mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Show modal for error renaming project (#19040)
GitOrigin-RevId: 229e64775897d646ed8c13f12d3bcc9400f2a3b9
This commit is contained in:
@@ -18,6 +18,7 @@ import getMeta from '../../utils/meta'
|
|||||||
import { useUserContext } from './user-context'
|
import { useUserContext } from './user-context'
|
||||||
import { saveProjectSettings } from '@/features/editor-left-menu/utils/api'
|
import { saveProjectSettings } from '@/features/editor-left-menu/utils/api'
|
||||||
import { PermissionsLevel } from '@/features/ide-react/types/permissions'
|
import { PermissionsLevel } from '@/features/ide-react/types/permissions'
|
||||||
|
import { useModalsContext } from '@/features/ide-react/context/modals-context'
|
||||||
|
|
||||||
type writefullAdButtons = '' | 'try-it' | 'log-in'
|
type writefullAdButtons = '' | 'try-it' | 'log-in'
|
||||||
|
|
||||||
@@ -59,6 +60,7 @@ export const EditorProvider: FC = ({ children }) => {
|
|||||||
const ide = useIdeContext()
|
const ide = useIdeContext()
|
||||||
const { id: userId } = useUserContext()
|
const { id: userId } = useUserContext()
|
||||||
const { role } = useDetachContext()
|
const { role } = useDetachContext()
|
||||||
|
const { showGenericMessageModal } = useModalsContext()
|
||||||
|
|
||||||
const { owner, features, _id: projectId } = useProjectContext()
|
const { owner, features, _id: projectId } = useProjectContext()
|
||||||
|
|
||||||
@@ -119,24 +121,18 @@ export const EditorProvider: FC = ({ children }) => {
|
|||||||
(response: any) => {
|
(response: any) => {
|
||||||
setProjectName(oldName)
|
setProjectName(oldName)
|
||||||
const { data, status } = response
|
const { data, status } = response
|
||||||
if (status === 400) {
|
|
||||||
return ide.showGenericMessageModal(
|
showGenericMessageModal(
|
||||||
'Error renaming project',
|
'Error renaming project',
|
||||||
data
|
status === 400 ? data : 'Please try again in a moment'
|
||||||
)
|
)
|
||||||
} else {
|
|
||||||
return ide.showGenericMessageModal(
|
|
||||||
'Error renaming project',
|
|
||||||
'Please try again in a moment'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return newName
|
return newName
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
[ide, setProjectName, projectId]
|
[setProjectName, projectId, showGenericMessageModal]
|
||||||
)
|
)
|
||||||
|
|
||||||
const { setTitle } = useBrowserWindow()
|
const { setTitle } = useBrowserWindow()
|
||||||
|
|||||||
Reference in New Issue
Block a user