Skip to content

Conversation

@dagrinchi
Copy link
Contributor

Another little corrections based in my experience using Keystone. Regards!.

Another little corrections based in my experience using Keystone. Regards!.
@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 90a3301:

Sandbox Source
@keystone-6/sandbox Configuration

Copy link
Member

@dcousens dcousens left a comment

Choose a reason for hiding this comment

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

Thanks @dagrinchi

```ts
const isAdmin = ({ session }: { session: Session }) => session?.data.isAdmin;
const isAdmin = ({ session }: { session: Session }) => Boolean(session?.data.isAdmin);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const isAdmin = ({ session }: { session: Session }) => Boolean(session?.data.isAdmin);
const isAdmin = ({ session }: { session?: Session }) => Boolean(session?.data.isAdmin);


```ts
const isAdmin = ({ session }: { session: Session }) => session?.data.isAdmin;
const isAdmin = ({ session }: { session: Session }) => Boolean(session?.data.isAdmin);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const isAdmin = ({ session }: { session: Session }) => Boolean(session?.data.isAdmin);
const isAdmin = ({ session }: { session?: Session }) => Boolean(session?.data.isAdmin);

!!session?.data.id;
// Validate the current user is an Admin
const isAdmin = ({ session }: { session: Session }) =>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const isAdmin = ({ session }: { session: Session }) =>
const isAdmin = ({ session }: { session?: Session }) =>

@dcousens dcousens merged commit 5df5be1 into keystonejs:main Feb 25, 2024
@dcousens
Copy link
Member

Oh, I shouldn't have merged this until we added the ?:, @dagrinchi feel free to submit another pull request, or otherwise I'll try and get to this tomorrow

@dcousens dcousens mentioned this pull request Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants