feat: adds and exports reusable auth server functions (#11900)
### What Adds exportable server functions for `login`, `logout` and `refresh` that are fully typed and ready to use. ### Why Creating server functions for these auth operations require the developer to manually set and handle the cookies / auth JWT. This can be a complex and involved process - instead we want to provide an option that will handle the cookies internally and simplify the process for the user. ### How Three re-usable functions can be exported from `@payload/next/server-functions`: - login - logout - refresh Examples of how to use these functions will be added to the docs shortly, along with more in-depth info on server functions.
This commit is contained in:
committed by
GitHub
parent
39462bc6b9
commit
6b349378e0
7
test/server-functions/components/refresh.tsx
Normal file
7
test/server-functions/components/refresh.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
'use client'
|
||||
import { refreshFunction } from './refreshFunction.js'
|
||||
|
||||
const RefreshToken = () => {
|
||||
return <button onClick={() => refreshFunction()}>Custom Refresh</button>
|
||||
}
|
||||
export default RefreshToken
|
||||
Reference in New Issue
Block a user