Skip to content

Commit

Permalink
fix linting and ts errors
Browse files Browse the repository at this point in the history
  • Loading branch information
doug-s-nava committed Jan 8, 2025
1 parent f7aee84 commit 28b2f3e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion frontend/src/app/api/auth/callback/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const createSessionAndSetStatus = async (
): Promise<string> => {
try {
await createSession(token);
console.log("~~~ session set");
return successStatus;
} catch (error) {
console.error("error in creating session", error);
Expand Down
1 change: 0 additions & 1 deletion frontend/src/app/api/auth/session/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export const revalidate = 0;

export async function GET() {
const currentSession = await getSession();
console.log("~~~ session got", currentSession);
if (currentSession) {
return NextResponse.json(currentSession);
} else {
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/components/user/UserControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,11 @@ const UserDropdown = ({
logout: () => Promise<void>;
}) => {
const [userProfileMenuOpen, setUserProfileMenuOpen] = useState(false);
// TODO mobile view
// TODO match sizing

const logoutNavItem = (
<a
className="display-flex usa-button usa-button--unstyled text-no-underline"
// eslint-disable-next-line
onClick={() => logout()}
>
<USWDSIcon name="logout" className="usa-icon--size-3 display-block" />
Expand All @@ -103,6 +102,10 @@ const UserDropdown = ({
<div className="usa-nav__primary-item border-top-0 mobile-nav-dropdown-uncollapsed-override">
<NavDropDownButton
className="padding-y-0 padding-x-2 margin-right-2 height-6"
// The NavDropDownButton needlessly restricts the label to a string, when passing an Element works
// perfectly well.
// eslint-disable-next-line
// @ts-ignore: Type 'Element' is not assignable to type 'string'
label={<UserEmailItem isSubnav={false} email={user.email} />}
isOpen={userProfileMenuOpen}
onToggle={() => setUserProfileMenuOpen(!userProfileMenuOpen)}
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/services/auth/UserProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ export default function UserProvider({
const getUserSession = useCallback(async (): Promise<void> => {
try {
setIsLoading(true);
console.log("~~~ fetching user");
const fetchedUser = await debouncedUserFetcher();
if (fetchedUser) {
console.log("~~~ fetchedUser", fetchedUser);
setLocalUser(fetchedUser);
setUserFetchError(undefined);
setIsLoading(false);
Expand All @@ -60,7 +58,7 @@ export default function UserProvider({
isLoading,
refreshUser: getUserSession,
}),
[localUser, userFetchError, isLoading],
[localUser, userFetchError, isLoading, getUserSession],
);

return <UserContext.Provider value={value}>{children}</UserContext.Provider>;
Expand Down

0 comments on commit 28b2f3e

Please sign in to comment.