Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requested changes #20

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 26 additions & 28 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,33 @@ import Logout from './routes/Logout';

const queryClient = new QueryClient();

function App() {
return (
<QueryClientProvider client={queryClient}>
<BrowserRouter>
<Routes>
<Route index element={<Home />} />
<Route path="/login" element={<Login />} />
<Route path="/sign_up" element={<SignUp />} />
<Route element={<ProtectedRoute />}>
<Route element={<Layout />}>
<Route path="/appointment-list" element={<AppointmentList />} />
<Route path="/appointment/:appId" element={<AppointmentUpdate />} />
<Route path="/doctors" element={<Doctors />} />
<Route path="/doctor/:id" element={<DoctorDetail />} />
<Route path="/create-appointment" element={<CreateAppointment />} />
<Route element={<ProtectedRouteAdmin />}>
<Route path="/add-docs" element={<AddDoc />} />
<Route path="/delete-docs" element={<DeleteDoc />} />
</Route>
const App = () => (
<QueryClientProvider client={queryClient}>
<BrowserRouter>
<Routes>
<Route index element={<Home />} />
<Route path="/login" element={<Login />} />
<Route path="/sign_up" element={<SignUp />} />
<Route element={<ProtectedRoute />}>
<Route element={<Layout />}>
<Route path="/appointment-list" element={<AppointmentList />} />
<Route path="/appointment/:appId" element={<AppointmentUpdate />} />
<Route path="/doctors" element={<Doctors />} />
<Route path="/doctor/:id" element={<DoctorDetail />} />
<Route path="/create-appointment" element={<CreateAppointment />} />
<Route element={<ProtectedRouteAdmin />}>
<Route path="/add-docs" element={<AddDoc />} />
<Route path="/delete-docs" element={<DeleteDoc />} />
</Route>
<Route path="/logout" element={<Logout />} />
</Route>
<Route path="/unauthorize" element={<UnAuthorize />} />
<Route path="*" element={<NotMatch />} />
</Routes>
</BrowserRouter>
<ToastContainer />
</QueryClientProvider>
);
}
<Route path="/logout" element={<Logout />} />
</Route>
<Route path="/unauthorize" element={<UnAuthorize />} />
<Route path="*" element={<NotMatch />} />
</Routes>
</BrowserRouter>
<ToastContainer />
</QueryClientProvider>
);

export default App;
4 changes: 1 addition & 3 deletions src/routes/AddDoc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ const AddDoc = () => {

const validFileExtensions = { image: ['jpg', 'gif', 'png', 'jpeg', 'svg', 'webp'] };

function isValidFileType(fileName, fileType) {
return fileName && validFileExtensions[fileType].indexOf(fileName.split('.').pop()) > -1;
}
const isValidFileType = (fileName, fileType) => fileName && validFileExtensions[fileType].indexOf(fileName.split('.').pop()) > -1;

const validationSchema = Yup.object().shape({
name: Yup.string()
Expand Down
16 changes: 10 additions & 6 deletions src/routes/Doctors.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,31 @@ import useWindowSize from '../hooks/use-window-size';
import 'slick-carousel/slick/slick.css';
import 'slick-carousel/slick/slick-theme.css';

function SampleNextArrow(props) {
const SampleNextArrow = (props) => {
const { className, style, onClick } = props;
return (
<div
className={className}
style={{ ...style, display: 'block', background: 'red' }}
style={{
...style, display: 'block', background: 'green', borderRadius: '50%',
}}
onClick={onClick}
/>
);
}
};

function SamplePrevArrow(props) {
const SamplePrevArrow = (props) => {
const { className, style, onClick } = props;
return (
<div
className={className}
style={{ ...style, display: 'block', background: 'green' }}
style={{
...style, display: 'block', background: 'green', borderRadius: '50%',
}}
onClick={onClick}
/>
);
}
};

const Doctors = () => {
const dispatch = useDispatch();
Expand Down
14 changes: 5 additions & 9 deletions src/routes/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Button from '../components/Button';
const Login = () => {
const [userSignedIn] = useSession();
const {
error, loggedIn, needsConfirmation,
loggedIn, needsConfirmation,
} = useSelector(selectAuth);
const dispatch = useDispatch();
const validationSchema = Yup.object().shape({
Expand All @@ -39,16 +39,12 @@ const Login = () => {

const login = (data) => {
toast.promise(
dispatch(
loginUser(data),
).then(() => {
if (error) {
toast.error(`Oops, something went wrong: ${error}`);
}
}),
dispatch(loginUser(data))
.catch((error) => {
toast.error(`Oops, something went wrong: ${error.message}`);
}),
{
pending: 'loading...',
error,
success: 'Service is working!',
},
);
Expand Down