codescandy / dashui-free-nextjs-admin-template

Dashui free nextjs admin dashboard template, built with latest react. Build your next project with DashUI React.
https://dashui.codescandy.com/next-js-admin-dashboard-template.html
MIT License
130 stars 88 forks source link

API #9

Open GMJSilmaro opened 2 weeks ago

GMJSilmaro commented 2 weeks ago

How does API Work here cause i can't do much and it wont load help ?

sandipthemes commented 2 weeks ago

Hi, @GMJSilmaro

Please check reply to the same issue, it might be helpful.

https://github.com/codescandy/dashui-free-nextjs-admin-template/issues/7

Let me know if it works :)

GMJSilmaro commented 2 weeks ago

Hi, @sandipthemes how about middleware can you help me how to setup? im really new and i like your template is there anyway to setup it? i want to redirect non authenticated users to your (auth)/authentication/sign-in

sandipthemes commented 2 weeks ago

If you want to redirect to specific page, you can use below code.

import { useRouter } from "next/navigation";
const Page = () => {
    const router = useRouter();
    return(<button onClick={() => router.push("/authentication/sign-in")}>Redirect</button>)
}

Please share, which middleware are you using for authentication process.