Skip to content

Commit

Permalink
Show how it type checks, probably not worth the verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusroemer committed Mar 21, 2024
1 parent 962672f commit 2c3051b
Showing 1 changed file with 36 additions and 11 deletions.
47 changes: 36 additions & 11 deletions website/src/pages/datasets/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,48 @@ import { urlForKeycloakAccountPage } from '../../utils/urlForKeycloakAccountPage
const session = Astro.locals.session!;
const accessToken = getAccessToken(session)!;
const username = session.user?.username ?? '';
const websiteConfig = getWebsiteConfig();
const websiteName = websiteConfig.name;
const clientConfig = getRuntimeConfig().public;
const datasetClient = DatasetCitationClient.create();
const keycloakClient = await KeycloakClientManager.getClient();
let datasetsResponse,

Check failure on line 18 in website/src/pages/datasets/index.astro

View workflow job for this annotation

GitHub Actions / Check format and types

Split 'let' declarations into multiple statements
userCitedByResponse,
authorResponse,
editAccountUrl,
websiteName,
clientConfig,
username,
websiteConfig,
datasetClient,
keycloakClient;
const datasetsResponse = await datasetClient.getDatasetsOfUser(accessToken);
const userCitedByResponse = await datasetClient.getUserCitedBy(username, accessToken);
const authorResponse = await datasetClient.getAuthor(username);
const editAccountUrl = (await urlForKeycloakAccountPage(keycloakClient!)) + '/#/personal-info';
if (accessToken) {
username = session.user?.username ?? '';
websiteConfig = getWebsiteConfig();
websiteName = websiteConfig.name;
clientConfig = getRuntimeConfig().public;
datasetClient = DatasetCitationClient.create();
keycloakClient = await KeycloakClientManager.getClient();
datasetsResponse = await datasetClient.getDatasetsOfUser(accessToken);
userCitedByResponse = await datasetClient.getUserCitedBy(username, accessToken);
authorResponse = await datasetClient.getAuthor(username);
editAccountUrl = (await urlForKeycloakAccountPage(keycloakClient!)) + '/#/personal-info';

Check failure on line 40 in website/src/pages/datasets/index.astro

View workflow job for this annotation

GitHub Actions / Check format and types

This assertion is unnecessary since it does not change the type of the expression
}
---

<BaseLayout title='Datasets' data-testid='datasets-list-container'>
<div class='flex flex-col justify-center items-center'>
{
!accessToken ? (
!(
accessToken &&
username &&

Check failure on line 49 in website/src/pages/datasets/index.astro

View workflow job for this annotation

GitHub Actions / Check format and types

Unexpected nullable string value in conditional. Please handle the nullish/empty cases explicitly
websiteName &&

Check failure on line 50 in website/src/pages/datasets/index.astro

View workflow job for this annotation

GitHub Actions / Check format and types

Unexpected nullable string value in conditional. Please handle the nullish/empty cases explicitly
clientConfig &&
datasetClient &&
keycloakClient &&
websiteConfig &&
authorResponse &&
datasetsResponse &&
userCitedByResponse &&
editAccountUrl

Check failure on line 58 in website/src/pages/datasets/index.astro

View workflow job for this annotation

GitHub Actions / Check format and types

Unexpected nullable string value in conditional. Please handle the nullish/empty cases explicitly
) ? (
<NeedToLogin message='You need to be logged in to create new datasets.' />
) : (
<div class='flex flex-row justify-center w-5/6 divide-x max-w-7xl'>
Expand Down

0 comments on commit 2c3051b

Please sign in to comment.