Skip to content

feat(tanstack-start): Add getAuth server function - #3900

Merged
octoper merged 5 commits into
mainfrom
vaggelis/eco-67-support-server-specific-functions
Aug 7, 2024
Merged

feat(tanstack-start): Add getAuth server function#3900
octoper merged 5 commits into
mainfrom
vaggelis/eco-67-support-server-specific-functions

Conversation

@octoper

Copy link
Copy Markdown
Contributor

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'exportconstfetchCurrentUserPosts=createServerFn('GET',async(_payload,ctx)=>{const{ userId }=awaitgetAuth(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:

@changeset-bot

changeset-botBot commented Aug 5, 2024

Copy link
Copy Markdown

🦋 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
NameType
@clerk/tanstack-startMinor

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

@wobsorianowobsoriano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking good 🚀

Comment threadpackages/tanstack-start/src/server/getAuth.ts Outdated
Comment threadpackages/tanstack-start/src/server/getAuth.ts Outdated
Comment threadpackages/tanstack-start/package.json
@octoper
octoperforce-pushed the vaggelis/eco-67-support-server-specific-functions branch from c2d6cad to 9928f1bCompareAugust 7, 2024 08:21
@octoper
octoper merged commit 7a393f8 into mainAug 7, 2024
@octoper
octoper deleted the vaggelis/eco-67-support-server-specific-functions branch August 7, 2024 12:40
@coderabbitaicoderabbitaiBot mentioned this pull request Apr 27, 2026
Sign up for freeto 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.

4 participants

@octoper@wobsoriano@nikospapcom@panteliselef