Skip to content

Commit

Permalink
Merge pull request #297 from Rushikesh-Sonawane99/shiksha-2.0
Browse files Browse the repository at this point in the history
 Issue #PS-793 chore: Implemented dynamic routing for the center and center details page
  • Loading branch information
itsvick authored Jun 18, 2024
2 parents ff2b1ec + 13f48f3 commit 499470c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/components/MenuDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const MenuDrawer: React.FC<DrawerProps> = ({
};

const isDashboard = router.pathname === '/dashboard';
const isTeacherCenter = router.pathname === '/teachingCenters';
const isTeacherCenter = router.pathname === '/centers';

return (
<Drawer
Expand Down Expand Up @@ -191,7 +191,7 @@ const MenuDrawer: React.FC<DrawerProps> = ({
}}
startIcon={<LocalLibraryOutlinedIcon />}
onClick={() => {
router.push(`/teachingCenters`); // Check route
router.push(`/centers`); // Check route
}}
>
{t('DASHBOARD.MY_TEACHING_CENTERS')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ import Tabs from '@mui/material/Tabs';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { useTheme } from '@mui/material/styles';
import { useTranslation } from 'next-i18next';
import { useRouter } from 'next/router';
import { GetStaticPaths } from 'next';

const TeachingCenterDetails = () => {
const [value, setValue] = React.useState(1);
const router = useRouter();
const { cohortId }: any = router.query;

const handleChange = (event: React.SyntheticEvent, newValue: number) => {
setValue(newValue);
Expand Down Expand Up @@ -141,5 +145,11 @@ export async function getStaticProps({ locale }: any) {
},
};
}
export const getStaticPaths: GetStaticPaths<{ slug: string }> = async () => {
return {
paths: [], //indicates that no page needs be created at build time
fallback: 'blocking', //indicates the type of fallback
};
};

export default TeachingCenterDetails;
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ChevronRightIcon from '@mui/icons-material/ChevronRight';
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
import Header from '@/components/Header';
import Image from 'next/image';
import building from '../assets/images/apartment.png';
import building from '../../assets/images/apartment.png';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { useRouter } from 'next/router';
import { useTheme } from '@mui/material/styles';
Expand Down Expand Up @@ -54,7 +54,8 @@ const TeachingCenters = () => {
>
<Box
onClick={() => {
router.push(`/teachingCenterDetails`); // Check route
// router.push(`/centers/${cohortId}`); // Check route
router.push(`/centers/12345`) //TODO: Replace 12345 with cohortId
}}
sx={{ cursor: 'pointer' }}
>
Expand Down
34 changes: 17 additions & 17 deletions src/services/MyClassDetailsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ export const getMyCohortMemberList = async ({
}
};

export const updateCohortMemberStatus = async ({
memberStatus,
statusReason
}: updateCohortMemberStatusParams): Promise<any> => {
const apiUrl: string = `${process.env.NEXT_PUBLIC_BASE_URL}/cohortmember/update/${userId}`;
try {
const response = await put(apiUrl, {
memberStatus,
statusReason
});
console.log('data', response?.data);
return response?.data;
} catch (error) {
console.error('error in attendance report api ', error);
// throw error;
}
};
// export const updateCohortMemberStatus = async ({
// memberStatus,
// statusReason
// }: updateCohortMemberStatusParams): Promise<any> => {
// const apiUrl: string = `${process.env.NEXT_PUBLIC_BASE_URL}/cohortmember/update/${userId}`;
// try {
// const response = await put(apiUrl, {
// memberStatus,
// statusReason
// });
// console.log('data', response?.data);
// return response?.data;
// } catch (error) {
// console.error('error in attendance report api ', error);
// // throw error;
// }
// };

0 comments on commit 499470c

Please sign in to comment.