Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Access Local API in Custom View

default discord avatar
enrico.bagattin2 years ago
5

I am trying to access Payload Local Api in my custom view that is overwriting the "List" view of one collection, if I import payload and I try to access payload.find I get

payload__WEBPACK_IMPORTED_MODULE_1__.default.find is not a function
  • default discord avatar
    jessesivonen2 years ago

    You cannot access Local API from front-end if I understood correctly. You must use either REST or GraphQL. In admin panel there might be some ready-made way to access the REST API. Maybe using React hooks?

  • default discord avatar
    enrico.bagattin2 years ago

    Now i understand, thank you

  • default discord avatar
    Deleted User2 years ago
    @1077612284869885973

    How did you solve this?

  • default discord avatar
    enrico.bagattin2 years ago
    @456226577798135808

    I used the standard REST api:

    https://payloadcms.com/docs/rest-api/overview
  • default discord avatar
    Deleted User2 years ago
    @1077612284869885973

    Alright. Thanks.

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.