open-nomad/ui/app/utils/notify-conflict.js
Phil Renaud 8ebaeaac0b
Handle conflict swith a cas qp on save and create (#14100)
* Handle conflict swith a cas qp on save and create

* Notify error and give them refresh or overwrite options

* Merge conflict missed, resolved

* Mirage fixture

* Integration test

* Bracket closed (thx jai)

* Adjust tests to account for number of variables with auto-conflicter
2022-08-15 17:24:34 -04:00

15 lines
380 B
JavaScript

// @ts-check
// Catches errors with conflicts (409)
// and allow the route to handle them.
import { set } from '@ember/object';
import codesForError from './codes-for-error';
export default function notifyConflict(parent) {
return (error) => {
if (codesForError(error).includes('409')) {
set(parent, 'hasConflict', true);
} else {
return error;
}
};
}