Skip to content

Commit

Permalink
fix: logged out users getting a login page for public projects (#6177)
Browse files Browse the repository at this point in the history
* Fix logged out users for public projects

* Fix lint
  • Loading branch information
AdityaHegde authored Nov 27, 2024
1 parent c97d6d1 commit 5caec82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
4 changes: 3 additions & 1 deletion web-admin/src/features/navigation/TopNavigationBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@
$: plan = createAdminServiceGetBillingSubscription(organization, {
query: {
enabled: !!organization && manageOrganization && !onPublicURLPage,
enabled: Boolean(
!!organization && manageOrganization && !onPublicURLPage,
),
select: (data) => data.subscription?.plan,
},
});
Expand Down
13 changes: 1 addition & 12 deletions web-admin/src/routes/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ import {
type V1OrganizationPermissions,
type V1ProjectPermissions,
} from "@rilldata/web-admin/client";
import {
redirectToLoginIfNotLoggedIn,
redirectToLoginOrRequestAccess,
} from "@rilldata/web-admin/features/authentication/checkUserAccess";
import { redirectToLoginOrRequestAccess } from "@rilldata/web-admin/features/authentication/checkUserAccess";
import { fetchOrganizationPermissions } from "@rilldata/web-admin/features/organizations/selectors";
import { queryClient } from "@rilldata/web-common/lib/svelte-query/globalQueryClient.js";
import { error, type Page } from "@sveltejs/kit";
Expand Down Expand Up @@ -47,14 +44,6 @@ export const load = async ({ params, url, route }) => {
if (e.response?.status !== 403) {
throw error(e.response.status, "Error fetching organization");
}
// Use without access to anything within the org will hit this, so redirect to access page here.
const didRedirect = await redirectToLoginIfNotLoggedIn();
if (!didRedirect) {
return {
organizationPermissions,
projectPermissions: <V1ProjectPermissions>{},
};
}
}
}

Expand Down

1 comment on commit 5caec82

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.