@youngshand/payload-auth-plugin
Version:
A temporary fork for testing of Authentication plugin for Payload CMS, use @payload-auth-plugin
21 lines (19 loc) • 486 B
text/typescript
import { AuthPluginOutput } from "../types.js"
interface BaseOptions {
name: string
}
export const refresh = async (
options: BaseOptions,
): Promise<AuthPluginOutput> => {
const base = process.env.NEXT_PUBLIC_SERVER_URL
const response = await fetch(`${base}/api/${options.name}/session/refresh`)
const { message, kind, data, isError, isSuccess } =
(await response.json()) as AuthPluginOutput
return {
message,
kind,
data,
isError,
isSuccess,
}
}