Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Commit

Permalink
feature: added cathedra endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
igaryakqwe committed Jan 4, 2024
1 parent 30f04b3 commit b680799
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import IconButton from '@/components/common/ui/icon-button-mui';
import { IconButtonSize } from '@/components/common/ui/icon-button-mui/types';
import { initialValues } from '@/components/pages/admin/teachers-admin-page/components/teachers-admin-search/constants';
import { AdminSearchFormFields } from '@/components/pages/admin/teachers-admin-page/components/teachers-admin-search/types';
import CathedraAPI from '@/lib/api/cathedras/CathedraAPI';

import * as styles from './TeachersAdminSearch.styles';

Expand All @@ -37,7 +38,14 @@ const TeachersAdminSearch: FC<TeachersAdminSearchProps> = ({ onSubmit }) => {
handleFormSubmit(values);
};

const { data: cathedras } = useQuery('cathedras');
const { data: cathedras } = useQuery('cathedras', CathedraAPI.getAll, {
staleTime: Infinity,
onError: err => {
console.log(err);
},
});

console.log(cathedras);

return (
<Formik initialValues={initialValues} onSubmit={handleFormSubmit}>
Expand Down
11 changes: 11 additions & 0 deletions src/lib/api/cathedras/CathedraAPI.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { client } from '@/lib/api/instance';
import { getAuthorizationHeader } from '@/lib/api/utils';

class CathedraAPI {
async getAll() {
const { data } = await client.get('/cathedras', getAuthorizationHeader());
return data;
}
}

export default new CathedraAPI();

0 comments on commit b680799

Please sign in to comment.