From 576c2b0c0c2e1daff0bdc5a8729afc2eb961cb36 Mon Sep 17 00:00:00 2001
From: Markus Thielker <mail.markus.thielker@gmail.com>
Date: Fri, 14 Mar 2025 13:46:11 +0100
Subject: [PATCH] N-FIN-93: update session handling in actions

---
 src/lib/actions/categoryCreateUpdate.ts | 4 ++--
 src/lib/actions/categoryDelete.ts       | 4 ++--
 src/lib/actions/clearAccountData.ts     | 4 ++--
 src/lib/actions/entityCreateUpdate.ts   | 4 ++--
 src/lib/actions/entityDelete.ts         | 4 ++--
 src/lib/actions/generateSampleData.ts   | 4 ++--
 src/lib/actions/paymentCreateUpdate.ts  | 4 ++--
 src/lib/actions/paymentDelete.ts        | 4 ++--
 8 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/lib/actions/categoryCreateUpdate.ts b/src/lib/actions/categoryCreateUpdate.ts
index aebadc8..0c6759d 100644
--- a/src/lib/actions/categoryCreateUpdate.ts
+++ b/src/lib/actions/categoryCreateUpdate.ts
@@ -3,7 +3,7 @@ import { ActionResponse } from '@/lib/types/actionResponse';
 import prisma from '@/prisma';
 import { URL_SIGN_IN } from '@/lib/constants';
 import { categoryFormSchema } from '@/lib/form-schemas/categoryFormSchema';
-import { getSession } from '@auth0/nextjs-auth0';
+import { auth0 } from '@/lib/auth';
 
 export default async function categoryCreateUpdate({
     id,
@@ -12,7 +12,7 @@ export default async function categoryCreateUpdate({
 }: z.infer<typeof categoryFormSchema>): Promise<ActionResponse> {
     'use server';
 
-    const session = await getSession();
+    const session = await auth0.getSession();
     if (!session) {
         return {
             type: 'error',
diff --git a/src/lib/actions/categoryDelete.ts b/src/lib/actions/categoryDelete.ts
index ba0e9d6..0103892 100644
--- a/src/lib/actions/categoryDelete.ts
+++ b/src/lib/actions/categoryDelete.ts
@@ -1,7 +1,7 @@
 import { ActionResponse } from '@/lib/types/actionResponse';
 import prisma from '@/prisma';
 import { URL_SIGN_IN } from '@/lib/constants';
-import { getSession } from '@auth0/nextjs-auth0';
+import { auth0 } from '@/lib/auth';
 
 export default async function categoryDelete(id: number): Promise<ActionResponse> {
     'use server';
@@ -14,7 +14,7 @@ export default async function categoryDelete(id: number): Promise<ActionResponse
         };
     }
 
-    const session = await getSession();
+    const session = await auth0.getSession();
     if (!session) {
         return {
             type: 'error',
diff --git a/src/lib/actions/clearAccountData.ts b/src/lib/actions/clearAccountData.ts
index 9ee448a..778a23e 100644
--- a/src/lib/actions/clearAccountData.ts
+++ b/src/lib/actions/clearAccountData.ts
@@ -1,12 +1,12 @@
 import { ActionResponse } from '@/lib/types/actionResponse';
 import { URL_SIGN_IN } from '@/lib/constants';
 import prisma from '@/prisma';
-import { getSession } from '@auth0/nextjs-auth0';
+import { auth0 } from '@/lib/auth';
 
 export default async function clearAccountData(): Promise<ActionResponse> {
     'use server';
 
-    const session = await getSession();
+    const session = await auth0.getSession();
     if (!session) {
         return {
             type: 'error',
diff --git a/src/lib/actions/entityCreateUpdate.ts b/src/lib/actions/entityCreateUpdate.ts
index d8c15fe..7739a43 100644
--- a/src/lib/actions/entityCreateUpdate.ts
+++ b/src/lib/actions/entityCreateUpdate.ts
@@ -3,7 +3,7 @@ import { ActionResponse } from '@/lib/types/actionResponse';
 import { entityFormSchema } from '@/lib/form-schemas/entityFormSchema';
 import prisma from '@/prisma';
 import { URL_SIGN_IN } from '@/lib/constants';
-import { getSession } from '@auth0/nextjs-auth0';
+import { auth0 } from '@/lib/auth';
 
 export default async function entityCreateUpdate({
     id,
@@ -13,7 +13,7 @@ export default async function entityCreateUpdate({
 }: z.infer<typeof entityFormSchema>): Promise<ActionResponse> {
     'use server';
 
-    const session = await getSession();
+    const session = await auth0.getSession();
     if (!session) {
         return {
             type: 'error',
diff --git a/src/lib/actions/entityDelete.ts b/src/lib/actions/entityDelete.ts
index fccc6fd..aea38f1 100644
--- a/src/lib/actions/entityDelete.ts
+++ b/src/lib/actions/entityDelete.ts
@@ -1,7 +1,7 @@
 import { ActionResponse } from '@/lib/types/actionResponse';
 import prisma from '@/prisma';
 import { URL_SIGN_IN } from '@/lib/constants';
-import { getSession } from '@auth0/nextjs-auth0';
+import { auth0 } from '@/lib/auth';
 
 export default async function entityDelete(id: number): Promise<ActionResponse> {
     'use server';
@@ -14,7 +14,7 @@ export default async function entityDelete(id: number): Promise<ActionResponse>
         };
     }
 
-    const session = await getSession();
+    const session = await auth0.getSession();
     if (!session) {
         return {
             type: 'error',
diff --git a/src/lib/actions/generateSampleData.ts b/src/lib/actions/generateSampleData.ts
index 37cc53d..a0af523 100644
--- a/src/lib/actions/generateSampleData.ts
+++ b/src/lib/actions/generateSampleData.ts
@@ -3,12 +3,12 @@ import type { Category, Entity } from '@prisma/client';
 import { EntityType } from '@prisma/client';
 import { URL_SIGN_IN } from '@/lib/constants';
 import { ActionResponse } from '@/lib/types/actionResponse';
-import { getSession } from '@auth0/nextjs-auth0';
+import { auth0 } from '@/lib/auth';
 
 export default async function generateSampleData(): Promise<ActionResponse> {
     'use server';
 
-    const session = await getSession();
+    const session = await auth0.getSession();
     if (!session) {
         return {
             type: 'error',
diff --git a/src/lib/actions/paymentCreateUpdate.ts b/src/lib/actions/paymentCreateUpdate.ts
index 4c304a9..c28285f 100644
--- a/src/lib/actions/paymentCreateUpdate.ts
+++ b/src/lib/actions/paymentCreateUpdate.ts
@@ -3,7 +3,7 @@ import { ActionResponse } from '@/lib/types/actionResponse';
 import prisma from '@/prisma';
 import { URL_SIGN_IN } from '@/lib/constants';
 import { paymentFormSchema } from '@/lib/form-schemas/paymentFormSchema';
-import { getSession } from '@auth0/nextjs-auth0';
+import { auth0 } from '@/lib/auth';
 
 export default async function paymentCreateUpdate({
     id,
@@ -16,7 +16,7 @@ export default async function paymentCreateUpdate({
 }: z.infer<typeof paymentFormSchema>): Promise<ActionResponse> {
     'use server';
 
-    const session = await getSession();
+    const session = await auth0.getSession();
     if (!session) {
         return {
             type: 'error',
diff --git a/src/lib/actions/paymentDelete.ts b/src/lib/actions/paymentDelete.ts
index dab905c..19df372 100644
--- a/src/lib/actions/paymentDelete.ts
+++ b/src/lib/actions/paymentDelete.ts
@@ -1,7 +1,7 @@
 import { ActionResponse } from '@/lib/types/actionResponse';
 import prisma from '@/prisma';
 import { URL_SIGN_IN } from '@/lib/constants';
-import { getSession } from '@auth0/nextjs-auth0';
+import { auth0 } from '@/lib/auth';
 
 export default async function paymentDelete(id: number): Promise<ActionResponse> {
     'use server';
@@ -14,7 +14,7 @@ export default async function paymentDelete(id: number): Promise<ActionResponse>
         };
     }
 
-    const session = await getSession();
+    const session = await auth0.getSession();
     if (!session) {
         return {
             type: 'error',