mirror of
https://github.com/fergalmoran/mixyboos.git
synced 2025-12-22 09:41:39 +00:00
My lovely ASP is back....
This commit is contained in:
@@ -10,6 +10,7 @@ const config = {
|
|||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
images: {
|
images: {
|
||||||
domains: [
|
domains: [
|
||||||
|
"mixyboos.dev.fergl.ie",
|
||||||
"cloudflare-ipfs.com",
|
"cloudflare-ipfs.com",
|
||||||
"avatars.githubusercontent.com",
|
"avatars.githubusercontent.com",
|
||||||
"mixyboos.twic.pics",
|
"mixyboos.twic.pics",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import Sidebar from "@/lib/components/layout/sidebar/Sidebar";
|
import Sidebar from "@/lib/components/layout/sidebar";
|
||||||
import Loading from "@/lib/components/widgets/Loading";
|
import Loading from "@/lib/components/widgets/Loading";
|
||||||
import { useSession } from "next-auth/react";
|
import { useSession } from "next-auth/react";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
@@ -8,9 +8,10 @@ const DashboardLayout = ({ children }: { children: React.ReactNode }) => {
|
|||||||
const { data: session } = useSession();
|
const { data: session } = useSession();
|
||||||
|
|
||||||
if (!session) return <Loading />;
|
if (!session) return <Loading />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-20 -mb-16 flex h-screen overflow-hidden">
|
<div className="mx-20 -mb-16 flex h-screen overflow-hidden">
|
||||||
<Sidebar session={session} />
|
<Sidebar />
|
||||||
<div className="w-full">{children}</div>
|
<div className="w-full">{children}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import Session from "@/lib/components/debug/Session";
|
import Session from "@/lib/components/debug/Session";
|
||||||
|
import { authOptions } from "@/lib/services/auth/config";
|
||||||
import { getServerSession } from "next-auth";
|
import { getServerSession } from "next-auth";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
const IndexPage = () => {
|
const IndexPage = () => {
|
||||||
const session = getServerSession();
|
const session = getServerSession(authOptions);
|
||||||
return <Session serverSession={session} />;
|
return <Session serverSession={session} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
3
src/lib/components/layout/sidebar/index.ts
Normal file
3
src/lib/components/layout/sidebar/index.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import Sidebar from "./sidebar";
|
||||||
|
|
||||||
|
export default Sidebar;
|
||||||
@@ -15,14 +15,12 @@ import { CgSandClock } from "react-icons/cg";
|
|||||||
import { BiCategoryAlt } from "react-icons/bi";
|
import { BiCategoryAlt } from "react-icons/bi";
|
||||||
import Loading from "../../widgets/Loading";
|
import Loading from "../../widgets/Loading";
|
||||||
import UserImage from "../../widgets/UserImage";
|
import UserImage from "../../widgets/UserImage";
|
||||||
import { type Session } from "next-auth";
|
import { useSession } from "next-auth/react";
|
||||||
|
|
||||||
type DashboardSidebarProps = {
|
const Sidebar = () => {
|
||||||
session: Session | undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
const DashboardSidebar = ({ session }: DashboardSidebarProps) => {
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { data: session } = useSession();
|
||||||
|
|
||||||
const _sidebarItemClick = (path: string | undefined): void => {
|
const _sidebarItemClick = (path: string | undefined): void => {
|
||||||
if (!path) return;
|
if (!path) return;
|
||||||
if (path.includes("dashboard")) {
|
if (path.includes("dashboard")) {
|
||||||
@@ -170,4 +168,4 @@ const DashboardSidebar = ({ session }: DashboardSidebarProps) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default DashboardSidebar;
|
export default Sidebar;
|
||||||
@@ -22,7 +22,7 @@ export const authOptions: AuthOptions = {
|
|||||||
CredentialsProvider({
|
CredentialsProvider({
|
||||||
name: "Email and Password",
|
name: "Email and Password",
|
||||||
credentials: {
|
credentials: {
|
||||||
userName: {
|
username: {
|
||||||
label: "Username",
|
label: "Username",
|
||||||
type: "text",
|
type: "text",
|
||||||
placeholder: "Username or email address",
|
placeholder: "Username or email address",
|
||||||
@@ -40,7 +40,7 @@ export const authOptions: AuthOptions = {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const token = await new AuthService().getAuthToken(
|
const token = await new AuthService().getAuthToken(
|
||||||
credentials.userName,
|
credentials.username,
|
||||||
credentials.password,
|
credentials.password,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -82,6 +82,7 @@ export const authOptions: AuthOptions = {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
async session({ session, token }) {
|
async session({ session, token }) {
|
||||||
|
session.id = token.sub as string;
|
||||||
session.user.accessToken = token.accessToken as string;
|
session.user.accessToken = token.accessToken as string;
|
||||||
session.user.displayName = token.displayName as string;
|
session.user.displayName = token.displayName as string;
|
||||||
session.user.profileImage = token.profileImage as string;
|
session.user.profileImage = token.profileImage as string;
|
||||||
|
|||||||
1
src/types/next-auth.d.ts
vendored
1
src/types/next-auth.d.ts
vendored
@@ -7,6 +7,7 @@ declare module "next-auth" {
|
|||||||
* Returned by `useSession`, `getSession` and received as a prop on the `SessionProvider` React Context
|
* Returned by `useSession`, `getSession` and received as a prop on the `SessionProvider` React Context
|
||||||
*/
|
*/
|
||||||
interface Session {
|
interface Session {
|
||||||
|
id: string;
|
||||||
user: User;
|
user: User;
|
||||||
}
|
}
|
||||||
interface User {
|
interface User {
|
||||||
|
|||||||
Reference in New Issue
Block a user