Как указать свой путь запроса на сервер для
<Resource name='user'
в getOne?
'use client';
import { Admin, Resource } from 'react-admin';
import { useUserStore } from '@/store/use-user-store';
import { redirect } from 'next/navigation';
import { ReportList } from './reports/list';
import customDataProvider from '@/api/custom-data-provider';
// import simpleRestProvider from "ra-data-simple-rest";
// import { axiosWithAuth } from '@/api/interceptors';
import { UserList } from './users/list';
import { UserEdit } from './users/edit';
const dataProvider = customDataProvider(`${process.env.NEXT_PUBLIC_SERVER_URL}/api`);
const AdminsPage = () => {
const { user, isLoading: isUserLoading } = useUserStore();
if (isUserLoading) return null;
if (!user?.isAdmin) return redirect('/');
console.log('isUserLoading ', isUserLoading, user?.isAdmin);
return (
<Admin dataProvider={dataProvider} >
<Resource
name='report'
recordRepresentation='title'
list={ReportList}
// create={ReportCreate}
// edit={ReportEdit}
/>
<Resource
name='user'
recordRepresentation='title'
list={UserList}
edit={UserEdit}
/>
</Admin>
);
};
export default AdminsPage;
@Get('get-by-id/:id')
@Auth()
@HttpCode(200)
async getById(@Param('id') id: string) {
const data = await this.userService.getById(id)
return data
}