chore: dont break the app by throwing error just yet

This commit is contained in:
Juan Di Toro 2024-03-19 23:47:33 +01:00
parent 9a8a7ee978
commit 65bf663b67
2 changed files with 52 additions and 12 deletions

View File

@ -10,10 +10,16 @@ type AccountData = AccountParams;
export const accountProvider: SdkProvider = { export const accountProvider: SdkProvider = {
getList: () => { getList: () => {
throw Error("Not Implemented") console.log("Not implemented");
return Promise.resolve({
data: [],
});
}, },
getOne: () => { getOne: () => {
throw Error("Not Implemented") console.log("Not implemented");
return Promise.resolve({
data: {},
});
}, },
// @ts-ignore // @ts-ignore
async update<TVariables extends AccountParams = AccountParams>( async update<TVariables extends AccountParams = AccountParams>(
@ -44,10 +50,16 @@ export const accountProvider: SdkProvider = {
}; };
}, },
create: () => { create: () => {
throw Error("Not Implemented") console.log("Not implemented");
return Promise.resolve({
data: {},
});
}, },
deleteOne: () => { deleteOne: () => {
throw Error("Not Implemented") console.log("Not implemented");
return Promise.resolve({
data: {},
});
}, },
getApiUrl: () => "", getApiUrl: () => "",
} }

View File

@ -1,11 +1,39 @@
import type { DataProvider } from "@refinedev/core"; import type { DataProvider } from "@refinedev/core";
import {SdkProvider} from "~/data/sdk-provider.js"; import { SdkProvider } from "~/data/sdk-provider.js";
export const fileProvider: SdkProvider = { export const fileProvider = {
getList: () => { throw Error("Not Implemented") }, getList: () => {
getOne: () => { throw Error("Not Implemented") }, console.log("Not implemented");
update: () => { throw Error("Not Implemented") }, return Promise.resolve({
create: () => { throw Error("Not Implemented") }, data: [],
deleteOne: () => { throw Error("Not Implemented") }, total: 0,
});
},
getOne: () => {
console.log("Not implemented");
return Promise.resolve({
data: {
id: 1
},
});
},
update: () => {
console.log("Not implemented");
return Promise.resolve({
data: {},
});
},
create: () => {
console.log("Not implemented");
return Promise.resolve({
data: {},
});
},
deleteOne: () => {
console.log("Not implemented");
return Promise.resolve({
data: {},
});
},
getApiUrl: () => "", getApiUrl: () => "",
} } satisfies SdkProvider;