Skip to content
Discussion options

You must be logged in to vote

Hey there,

So we have an implementation of preview buttons for our collections. I'm not really sure, but I think that you can use the Payload API in the React component and call a custom endpoint (https://payloadcms.com/docs/rest-api/overview#custom-endpoints)

Field config

import { Field } from "payload/types";
import { PreviewButtonField } from "./components/PreviewButtonField";

export const PreviewButtons: Field = {
    name: "previewButtons",
    label: "Voorbeeld",
    type: "ui",
    admin: {
        position: "sidebar",
        components: {
            Field: PreviewButtonField,
        }
    }
}

React component:

import { Button } from "payload/components";
import { Label, useForm…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@unonweb
Comment options

Answer selected by unonweb
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants