mirror of
https://github.com/kemko/nomad.git
synced 2026-01-03 08:55:43 +03:00
20 lines
459 B
JavaScript
20 lines
459 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
// @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;
|
|
}
|
|
};
|
|
}
|