github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/utils/notify-conflict.js (about) 1 // @ts-check 2 // Catches errors with conflicts (409) 3 // and allow the route to handle them. 4 import { set } from '@ember/object'; 5 import codesForError from './codes-for-error'; 6 export default function notifyConflict(parent) { 7 return (error) => { 8 if (codesForError(error).includes('409')) { 9 set(parent, 'hasConflict', true); 10 } else { 11 return error; 12 } 13 }; 14 }