Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaHegde committed Oct 25, 2024
1 parent 7bf38fd commit 333ad8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 8 additions & 6 deletions web-admin/src/routes/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,39 @@ import {
} from "../features/public-urls/get-project-with-bearer-token.js";

export const load = async ({ params, url }) => {
const { organization, project, token } = params;
let effectiveToken = token;
const { organization, project, token: routeToken } = params;

if (!organization || !project) {
return {
projectPermissions: <V1ProjectPermissions>{},
};
}

let searchParamToken: string | undefined;
if (url.searchParams.has("token")) {
effectiveToken = url.searchParams.get("token");
searchParamToken = url.searchParams.get("token");
}

const token = searchParamToken ?? routeToken;

let queryKey: QueryKey;
let queryFn: QueryFunction<
Awaited<ReturnType<typeof adminServiceGetProject>>
>;

if (effectiveToken) {
if (token) {
queryKey = getAdminServiceGetProjectWithBearerTokenQueryKey(
organization,
project,
effectiveToken,
token,
{},
);

queryFn = ({ signal }) =>
adminServiceGetProjectWithBearerToken(
organization,
project,
effectiveToken,
token,
{},
signal,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
</CtaMessage>
</div>
{/if}
<!-- User accessing with token wont have access to view report. So only show for other rows. -->
{#if !token}
<CtaButton
variant="secondary"
Expand Down

0 comments on commit 333ad8a

Please sign in to comment.