MCPcopy Create free account
hub / github.com/benwinding/react-admin-import-csv / updateInDataProviderFallback

Function updateInDataProviderFallback

src/uploader.ts:193–210  ·  view source on GitHub ↗
(
  dataProvider: DataProvider,
  resource: string,
  values: any[]
)

Source from the content-addressed store, hash-verified

191}
192
193async function updateInDataProviderFallback(
194 dataProvider: DataProvider,
195 resource: string,
196 values: any[]
197): Promise<ReportItem[]> {
198 const reportItems: ReportItem[] = [];
199 await Promise.all(
200 values.map((value) =>
201 dataProvider
202 .update(resource, { id: value.id, data: value, previousData: null as any })
203 .then((res) =>
204 reportItems.push({ value: value, success: true, response: res })
205 )
206 .catch((err) => reportItems.push({ value: value, success: false, err }))
207 )
208 );
209 return reportItems;
210}
211
212function doesErrorContainString(error: any, stringsToCheck: string[]): boolean {
213 const errorString = (!!error && typeof error === 'object' && error?.toString()) || '';

Callers 1

updateInDataProviderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected