github.com/hernad/nomad@v1.6.112/ui/app/utils/notify-conflict.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  // @ts-check
     7  // Catches errors with conflicts (409)
     8  // and allow the route to handle them.
     9  import { set } from '@ember/object';
    10  import codesForError from './codes-for-error';
    11  export default function notifyConflict(parent) {
    12    return (error) => {
    13      if (codesForError(error).includes('409')) {
    14        set(parent, 'hasConflict', true);
    15      } else {
    16        return error;
    17      }
    18    };
    19  }