1
0
Fork 0
mirror of synced 2024-09-29 08:41:16 +13:00

Fix bug which causes an 'undefined' layout to appear if the save call 409s

This commit is contained in:
Andrew Kingston 2021-06-30 09:35:31 +01:00
parent 24172d111c
commit 0f3b447896

View file

@ -211,6 +211,11 @@ export const getFrontendStore = () => {
const response = await api.post(`/api/layouts`, layoutToSave)
const savedLayout = await response.json()
// Abort if saving failed
if (response.status !== 200) {
return
}
store.update(state => {
const layoutIdx = state.layouts.findIndex(
stateLayout => stateLayout._id === savedLayout._id