Skip to content

Conversation

@octoper
Copy link
Member

@octoper octoper commented Aug 5, 2024

Description

This PR introduces getAuth server function that can be used inside the TanStack start createServerFn.

Example:

import { getAuth } from '@clerk/tanstack-start/server'
import { createServerFn } from '@tanstack/start'


export const fetchCurrentUserPosts = createServerFn('GET', async (_payload, ctx) => {
  const { userId } = await getAuth(ctx)

  if (!userId) {
    ...
  }

  ...
})

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@octoper octoper self-assigned this Aug 5, 2024
@changeset-bot
Copy link

changeset-bot bot commented Aug 5, 2024

🦋 Changeset detected

Latest commit: 1afafcd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clerk/tanstack-start Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@wobsoriano wobsoriano left a comment

Choose a reason for hiding this comment

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

Looking good 🚀

@octoper octoper force-pushed the vaggelis/eco-67-support-server-specific-functions branch from c2d6cad to 9928f1b Compare August 7, 2024 08:21
@octoper octoper merged commit 7a393f8 into main Aug 7, 2024
@octoper octoper deleted the vaggelis/eco-67-support-server-specific-functions branch August 7, 2024 12:40
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.

5 participants