Skip to content

Commit

Permalink
bug fixes & minor changes
Browse files Browse the repository at this point in the history
- #1 fix bug with redirect url not having query params when logged out
  if user is on files page and logs out, he is redirected to login
  page from files
  if user immediately logs in again they are redirected back to files
  page but files
  page needs some query parameters to fetch data (specifically region),
  this was fixed
- #2 fix bug on sign up page optional email field wasn't being sent
in sign up payload.
- change on navbar to hide aws account switcher for admins when they
are on user management page.
  as account switch redirects them to files page which they don't need.
  • Loading branch information
hrishix6 committed Dec 8, 2023
1 parent f1fd5f9 commit ec4e8fc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion client/src/domain/auth/routes/sign.up.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function SignUpPage() {
e.preventDefault();
setLoading(true);
try {
const result = await attemptSignUp({ username, password: pass });
const result = await attemptSignUp({ username, password: pass, email });
if (!result.success) {
toast.error('Something went wrong.', {
className: 'bg-background text-foreground',
Expand Down
17 changes: 6 additions & 11 deletions client/src/domain/layout/components/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export function Navbar() {
const location = useLocation();
const { pathname } = location;

const isAdminRoute = pathname.startsWith('/_');
const isFileRoute = pathname.startsWith('/s3');

return (
<nav className="flex items-center justify-between">
<div className="flex items-center bg-background gap-1 py-1 lg:ml-2">
Expand All @@ -35,28 +38,20 @@ export function Navbar() {
replace
className="block px-2 py-1 font-semibold text-sm text-muted-foreground hover:text-primary hover:bg-accent"
>
<span
className={pathname.startsWith('/s3') ? 'text-primary' : ''}
>
Files
</span>
<span className={isFileRoute ? 'text-primary' : ''}>Files</span>
</Link>
<Link
to={'/_/users'}
replace
className="block px-4 py-1 font-semibold text-sm text-muted-foreground hover:text-primary hover:bg-accent"
>
<span
className={pathname.startsWith('/_/') ? 'text-primary' : ''}
>
Admin
</span>
<span className={isAdminRoute ? 'text-primary' : ''}>Admin</span>
</Link>
</div>
)}
</div>
<div className="flex items-center gap-2">
<AwsAccountsDropdown />
{isFileRoute ? <AwsAccountsDropdown /> : <></>}
<AccountOptionsDropdown />
<ThemeToggle />
</div>
Expand Down
6 changes: 4 additions & 2 deletions client/src/routes/protected.route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ interface Props {
}

export function ProtectedRoute(props: Props) {
const { pathname } = useLocation();
const { pathname, search } = useLocation();
const isAuthenticated = useAppSelector(selectIsAuthenticated);

const redirectPath = `${pathname}${search}`;

if (!isAuthenticated) {
return <Navigate to={`/login?redirect=${pathname}`} replace />;
return <Navigate to={`/login?redirect=${redirectPath}`} replace />;
}

return <>{props.children}</>;
Expand Down

0 comments on commit ec4e8fc

Please sign in to comment.