Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
intrn(component): generalize resetting of resource
Browse files Browse the repository at this point in the history
  • Loading branch information
lemredd committed Nov 23, 2022
1 parent a9e8c4f commit 8107222
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions components/resource_management/helpers/reset_resource_list.ts
Original file line number Diff line number Diff line change
@@ -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<T, U>,
W extends DeserializedResourceListDocument<T, U, V>
>(
list: Ref<W>,
receivedErrors: Ref<string[]>,
selectedIDs: Ref<string[]>,
fetchResourceInfo: () => Promise<void>
) {
list.value = {
...list.value,
"data": [],
"meta": {
...list.value.meta,
"count": 0
}
}
receivedErrors.value = []
selectedIDs.value = []

await fetchResourceInfo()
}

0 comments on commit 8107222

Please sign in to comment.