diff --git a/components/resource_management/helpers/reset_resource_list.ts b/components/resource_management/helpers/reset_resource_list.ts index e69de29bb..281ef24c5 100644 --- a/components/resource_management/helpers/reset_resource_list.ts +++ b/components/resource_management/helpers/reset_resource_list.ts @@ -0,0 +1,35 @@ +import { Ref } from "vue" + +import type { + ResourceIdentifier, + Attributes, + + DeserializedResource, + DeserializedResourceListDocument +} from "$/types/documents/base" + + +export default async function< + T extends ResourceIdentifier<"read">, + U extends Attributes<"deserialized">, + V extends DeserializedResource, + W extends DeserializedResourceListDocument +>( + list: Ref, + receivedErrors: Ref, + selectedIDs: Ref, + fetchResourceInfo: () => Promise +) { + list.value = { + ...list.value, + "data": [], + "meta": { + ...list.value.meta, + "count": 0 + } + } + receivedErrors.value = [] + selectedIDs.value = [] + + await fetchResourceInfo() +}