Giter Site home page Giter Site logo

Comments (6)

imCorfitz avatar imCorfitz commented on June 16, 2024

When initialising the next-payload package, you will noticed that in your app directory will be created a group folder called (payload) inside which is a folder called admin which is the route set by payload by default.

Inside your next.config.ts file you are then asked to wrap your config in the withPayload helper. This wrapper sets a few next.config parameters for you, one of which is the handling of all routes on the admin path.

The reason you get 404 is likely that you attempt to use dashboard as your admin route, but the configuration isn't set up to match this path.

from next-payload.

JarrodMFlesch avatar JarrodMFlesch commented on June 16, 2024

I am going to close this issue @okeken. I believe @imCorfitz is correct, unless you manually changed the folder name inside app/(payload)/admin to app/(payload)/dashboard and adjusted your payload config's admin path to match this.

Also note that the reset password url is /reset-password not /reset

from next-payload.

okeken avatar okeken commented on June 16, 2024

@JarrodMFlesch correct, I changed the (payload)/admin to match the admin route in my payload.config.ts file, is there a way to use a custom name other than admin, I'm using it for a web app, where the dashboard is also being being used by the end users.

from next-payload.

JarrodMFlesch avatar JarrodMFlesch commented on June 16, 2024

I might be confused, what's not working for you? You set the admin route on routes.admin to '/dashboard' on your payload config? https://payloadcms.com/docs/configuration/overview#options

from next-payload.

imCorfitz avatar imCorfitz commented on June 16, 2024

You might also need to set the rewrite in next.config.js. I have created a PR that enables you to set the custom path as part of the withPayload config, and some documentation along with it. #47

But basically, the withPayload wrapper in next.config.js creates a rewrite config which forwards all routes on /admin/* to the page.tsx in /app/(payload)/admin. In order to change this, you would need to add a custom rewrite object to your next.config.js which says something like

{
   rewrites: [
       {
           source: "/dashboard/:path*",
           destination: "/dashboard",
       }
   ]
}

from next-payload.

JarrodMFlesch avatar JarrodMFlesch commented on June 16, 2024

oh @imCorfitz nice! I will check that out and a couple other outstanding PR's here as well today.

from next-payload.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.