Skip to content

Commit 3885cce

Browse files
committed
task: remove notification wrapper in authcomponents
1 parent e285032 commit 3885cce

2 files changed

Lines changed: 37 additions & 28 deletions

File tree

frontend/src/components/AuthManager/AuthManager.tsx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ const AuthManager = () => {
106106
// This is now primarily a fallback for environments where server-side
107107
// sessions are same-site (e.g., local development). In production, we
108108
// prefer the stateless JWT passed via the URL query parameter.
109-
const handleSSOCallback = async (event?: React.FormEvent<HTMLFormElement>) => {
109+
const handleSSOCallback = async (
110+
event?: React.FormEvent<HTMLFormElement>
111+
) => {
110112
try {
111113
const response = await fetch(
112114
`${import.meta.env.VITE_SERVER_URL}/api/sso/profile`,
@@ -354,29 +356,27 @@ const AuthManager = () => {
354356
document.body
355357
)}
356358
<AuthContext.Provider value={{ logout, id, user, refreshUser }}>
357-
<SubscribeWrapper userId={id}>
358-
<Routes>
359-
<Route path="/admin/*" element={<AdminRoutes />} />
360-
<Route path="/rider/*" element={<RiderRoutes />} />
361-
<Route path="/driver/*" element={<DriverRoutes />} />
362-
<Route
363-
path="/"
364-
element={
365-
<Navigate
366-
to={
367-
localStorage.getItem('userType') === 'Admin'
368-
? '/admin/home'
369-
: localStorage.getItem('userType') === 'Driver'
370-
? '/driver/rides'
371-
: '/rider/schedule'
372-
}
373-
replace
374-
/>
375-
}
376-
/>
377-
<Route path="*" element={<Navigate to="/" replace />} />
378-
</Routes>
379-
</SubscribeWrapper>
359+
<Routes>
360+
<Route path="/admin/*" element={<AdminRoutes />} />
361+
<Route path="/rider/*" element={<RiderRoutes />} />
362+
<Route path="/driver/*" element={<DriverRoutes />} />
363+
<Route
364+
path="/"
365+
element={
366+
<Navigate
367+
to={
368+
localStorage.getItem('userType') === 'Admin'
369+
? '/admin/home'
370+
: localStorage.getItem('userType') === 'Driver'
371+
? '/driver/rides'
372+
: '/rider/schedule'
373+
}
374+
replace
375+
/>
376+
}
377+
/>
378+
<Route path="*" element={<Navigate to="/" replace />} />
379+
</Routes>
380380
</AuthContext.Provider>
381381
</>
382382
);

server/src/router/rider.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ import * as db from './common';
66
import { Rider } from '../models/rider';
77
import { RiderType } from '@carriage-web/shared/types/rider';
88
import { Location } from '../models/location';
9-
import { createKeys, validateUser, checkNetIDExists, checkNetIDExistsForOtherEmployee } from '../util';
9+
import {
10+
createKeys,
11+
validateUser,
12+
checkNetIDExists,
13+
checkNetIDExistsForOtherEmployee,
14+
} from '../util';
1015
import { Ride } from '../models/ride';
1116
import { RideType, Type, Status } from '@carriage-web/shared/types/ride';
1217
import { UserType } from '../models/subscription';
@@ -19,6 +24,7 @@ router.get('/usage', validateUser('Admin'), (req, res) => {
1924
noShows: number;
2025
totalRides: number;
2126
};
27+
2228
type Usage = {
2329
[id: string]: UsageData;
2430
};
@@ -199,7 +205,7 @@ router.post('/', validateUser('Admin'), async (req, res) => {
199205
const emailExists = await checkNetIDExists(body.email, 'rider');
200206
if (emailExists) {
201207
return res.status(409).send({
202-
err: 'A user with this NetID already exists'
208+
err: 'A user with this NetID already exists',
203209
});
204210
}
205211

@@ -225,10 +231,13 @@ router.put('/:id', validateUser('Rider'), async (req, res) => {
225231

226232
// Check if email is being changed and if it conflicts with another user
227233
if (body.email) {
228-
const emailExists = await checkNetIDExistsForOtherEmployee(body.email, id);
234+
const emailExists = await checkNetIDExistsForOtherEmployee(
235+
body.email,
236+
id
237+
);
229238
if (emailExists) {
230239
return res.status(409).send({
231-
err: 'A user with this NetID already exists'
240+
err: 'A user with this NetID already exists',
232241
});
233242
}
234243
}

0 commit comments

Comments
 (0)