Forcing usage of id to getOne
This commit is contained in:
@@ -33,7 +33,7 @@ export const FirmRoutes = () => {
|
||||
|
||||
const FirmHome = () => {
|
||||
const { currentFirm } = useContext(FirmContext);
|
||||
const { data: firm, isError, error, isLoading } = useOne({resource: 'firm', id: `${currentFirm.instance}/${currentFirm.firm}`, errorNotification: false})
|
||||
const { data: firm, isError, error, isLoading } = useOne({resource: 'firm', id: `${currentFirm.instance}/${currentFirm.firm}/`, errorNotification: false})
|
||||
|
||||
if (isLoading) {
|
||||
return <h1>Loading...</h1>
|
||||
|
||||
@@ -4,7 +4,10 @@ const API_URL = "/api/v1";
|
||||
|
||||
export const dataProvider: DataProvider = {
|
||||
getOne: async ({ resource, id, meta }) => {
|
||||
const response = id !== "" ? await fetch(`${API_URL}/${resource}/${id}`) : await fetch(`${API_URL}/${resource}`);
|
||||
if (id === "") {
|
||||
return { data: undefined };
|
||||
}
|
||||
const response = await fetch(`${API_URL}/${resource}/${id}`);
|
||||
if (response.status < 200 || response.status > 299) {
|
||||
if (response.status == 405) {
|
||||
const error: HttpError = {
|
||||
|
||||
Reference in New Issue
Block a user