Skip to content

Commit

Permalink
ar(rebase) main
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloreale committed Aug 26, 2024
2 parents 0ddd12e + ede0313 commit 5e9b532
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
14 changes: 9 additions & 5 deletions src/app/[locale]/components/server/blocks/topnav.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// topnav.tsx
'use server';
import type { UserSchema } from '@types';
import { getSession } from '@auth';
import { VTopNav } from '@blocks/client';

import { cookies } from 'next/headers';

interface ITopNavProps {
user?: any;
services?: any;
user?: UserSchema | undefined;
}

interface ISignInData {
Expand All @@ -21,8 +21,12 @@ interface IAuthProviders {
name?: string;
}

export const CTopNav = async ({ user, services }: ITopNavProps) => {
export const CTopNav = async ({ user }: ITopNavProps) => {
const cookieStore = cookies().getAll();
const cookieStr = cookieStore.toString();

const session = await getSession({ cookies: cookieStr });
return <div>
<VTopNav user={user} services={services} />
<VTopNav user={session?.user} />
</div>;
};
13 changes: 13 additions & 0 deletions src/app/[locale]/dash/services/hypnos/[mode]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// page.tsx
import { DPPublicListings } from '@blocks/server';

export default function Home({ params }: any) {
const mode = params?.mode || 'list';
return (
<main>
<section>
<DPPublicListings mode={mode} />
</section>
</main>
);
}
12 changes: 9 additions & 3 deletions src/app/[locale]/gateway/client/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ export async function navigate(url: string) {
redirect(url);
}

export async function setCookie({ name, value, secure }: { name: string; value: string; secure: boolean }) {
export async function setCookie({ name, value }: { name: string; value: string }) {
// Set cookie
const cookiesStore = cookies();
cookiesStore.set(name, value, { secure });
cookiesStore.set(name, value, { secure: true });
}

export async function getCookie({ name }: { name: string }) {
return cookies().get(name)?.value;
// Set cookie
// const cookiesStore = cookies()
// const currentCookies = cookiesStore.getAll();
// console.log({ currentCookies })
return cookies().get(name);
// console.log({ nextCookies: currentCookies })
}

0 comments on commit 5e9b532

Please sign in to comment.