type NameableResource = Resource & { name?: string };
export const verifyAndUpdateLink = async (link: LinkResource, dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise<LinkResource> => {
- //check if head resource is already in the store
+ //head resource should already be in the store
let headResource: Resource | undefined = getState().resources[link.headUuid];
//if not, fetch it
if (!headResource) {
};
export const verifyAndUpdateLinks = async (links: LinkResource[], dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+
const updatedLinks = links.map((link) => verifyAndUpdateLink(link, dispatch, getState, services));
return Promise.all(updatedLinks);
};