{{! Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 }} {{yield}} {{#let (hash data=data error=error invalidate=this.invalidate dispatchError=(queue (action (mut error) value="error.errors.firstObject") (action dispatch "ERROR")) ) as |api|}} {{#yield-slot name="data"}} {{yield api}} {{else}} {{! if we didn't specify any data}} {{#if (not items)}} {{! try and load the data if we aren't in an error state}} {{! but only if we only asked for a single load and we are in loading state}} {{#if (and src (or (not once) (state-matches state "loading")))}} {{did-insert (set this 'invalidate' source.invalidate)}} {{/if}} {{/if}} {{/yield-slot}} {{#yield-slot name="loading"}} {{yield api}} {{else}} {{/yield-slot}} {{#yield-slot name="error"}} {{yield api}} {{else}} {{/yield-slot}} {{#if (not (eq error.status '401'))}} {{#yield-slot name="disconnected" params=(block-params (action dispatch "RESET"))}} {{yield api}} {{else}} Warning! An error was returned whilst loading this data, refresh to try again. {{/yield-slot}} {{/if}} {{#if (eq error.status "403")}} {{#yield-slot name="error"}} {{yield api}} {{else}} {{/yield-slot}} {{else}} {{yield api}} {{/if}} {{/let}} {{did-update (fn dispatch "LOAD") src=src}}