diff --git a/src/app/actions/app-actions/install-app-action.ts b/src/app/actions/app-actions/install-app-action.ts index 37a851f1..fca474a8 100644 --- a/src/app/actions/app-actions/install-app-action.ts +++ b/src/app/actions/app-actions/install-app-action.ts @@ -1,7 +1,6 @@ 'use server'; import { z } from 'zod'; -import { db } from '@/server/db'; import { action } from '@/lib/safe-action'; import { revalidatePath } from 'next/cache'; import { AppServiceClass } from '@/server/services/apps/apps.service'; @@ -19,16 +18,15 @@ const input = z.object({ */ export const installAppAction = action(input, async ({ id, form }) => { try { - const appsService = new AppServiceClass(db); - + const appsService = new AppServiceClass(); await appsService.installApp(id, form); - revalidatePath('/apps'); - revalidatePath(`/app/${id}`); - revalidatePath(`/app-store/${id}`); - return { success: true }; } catch (e) { - return handleActionError(e); + return await handleActionError(e); + } finally { + revalidatePath('/apps'); + revalidatePath(`/app/${id}`); + revalidatePath(`/app-store/${id}`); } }); diff --git a/src/app/actions/app-actions/start-app-action.ts b/src/app/actions/app-actions/start-app-action.ts index 28f4071e..2c454303 100644 --- a/src/app/actions/app-actions/start-app-action.ts +++ b/src/app/actions/app-actions/start-app-action.ts @@ -1,7 +1,6 @@ 'use server'; import { z } from 'zod'; -import { db } from '@/server/db'; import { action } from '@/lib/safe-action'; import { revalidatePath } from 'next/cache'; import { AppServiceClass } from '@/server/services/apps/apps.service'; @@ -14,16 +13,15 @@ const input = z.object({ id: z.string() }); */ export const startAppAction = action(input, async ({ id }) => { try { - const appsService = new AppServiceClass(db); - + const appsService = new AppServiceClass(); await appsService.startApp(id); - revalidatePath('/apps'); - revalidatePath(`/app/${id}`); - revalidatePath(`/app-store/${id}`); - return { success: true }; } catch (e) { - return handleActionError(e); + return await handleActionError(e); + } finally { + revalidatePath('/apps'); + revalidatePath(`/app/${id}`); + revalidatePath(`/app-store/${id}`); } }); diff --git a/src/app/actions/app-actions/stop-app-action.ts b/src/app/actions/app-actions/stop-app-action.ts index a4fe953f..7856da13 100644 --- a/src/app/actions/app-actions/stop-app-action.ts +++ b/src/app/actions/app-actions/stop-app-action.ts @@ -1,7 +1,6 @@ 'use server'; import { z } from 'zod'; -import { db } from '@/server/db'; import { action } from '@/lib/safe-action'; import { revalidatePath } from 'next/cache'; import { AppServiceClass } from '@/server/services/apps/apps.service'; @@ -14,16 +13,15 @@ const input = z.object({ id: z.string() }); */ export const stopAppAction = action(input, async ({ id }) => { try { - const appsService = new AppServiceClass(db); - + const appsService = new AppServiceClass(); await appsService.stopApp(id); - revalidatePath('/apps'); - revalidatePath(`/app/${id}`); - revalidatePath(`/app-store/${id}`); - return { success: true }; } catch (e) { - return handleActionError(e); + return await handleActionError(e); + } finally { + revalidatePath('/apps'); + revalidatePath(`/app/${id}`); + revalidatePath(`/app-store/${id}`); } }); diff --git a/src/app/actions/app-actions/uninstall-app-action.ts b/src/app/actions/app-actions/uninstall-app-action.ts index 5871f952..6d0886e3 100644 --- a/src/app/actions/app-actions/uninstall-app-action.ts +++ b/src/app/actions/app-actions/uninstall-app-action.ts @@ -1,7 +1,6 @@ 'use server'; import { z } from 'zod'; -import { db } from '@/server/db'; import { action } from '@/lib/safe-action'; import { revalidatePath } from 'next/cache'; import { AppServiceClass } from '@/server/services/apps/apps.service'; @@ -14,16 +13,15 @@ const input = z.object({ id: z.string() }); */ export const uninstallAppAction = action(input, async ({ id }) => { try { - const appsService = new AppServiceClass(db); - + const appsService = new AppServiceClass(); await appsService.uninstallApp(id); - revalidatePath('/apps'); - revalidatePath(`/app/${id}`); - revalidatePath(`/app-store/${id}`); - return { success: true }; } catch (e) { - return handleActionError(e); + return await handleActionError(e); + } finally { + revalidatePath('/apps'); + revalidatePath(`/app/${id}`); + revalidatePath(`/app-store/${id}`); } }); diff --git a/src/app/actions/app-actions/update-app-action.ts b/src/app/actions/app-actions/update-app-action.ts index b45dde40..863cb4cd 100644 --- a/src/app/actions/app-actions/update-app-action.ts +++ b/src/app/actions/app-actions/update-app-action.ts @@ -1,7 +1,6 @@ 'use server'; import { z } from 'zod'; -import { db } from '@/server/db'; import { action } from '@/lib/safe-action'; import { revalidatePath } from 'next/cache'; import { AppServiceClass } from '@/server/services/apps/apps.service'; @@ -14,16 +13,15 @@ const input = z.object({ id: z.string() }); */ export const updateAppAction = action(input, async ({ id }) => { try { - const appsService = new AppServiceClass(db); - + const appsService = new AppServiceClass(); await appsService.updateApp(id); - revalidatePath('/apps'); - revalidatePath(`/app/${id}`); - revalidatePath(`/app-store/${id}`); - return { success: true }; } catch (e) { - return handleActionError(e); + return await handleActionError(e); + } finally { + revalidatePath('/apps'); + revalidatePath(`/app/${id}`); + revalidatePath(`/app-store/${id}`); } }); diff --git a/src/app/actions/app-actions/update-app-config-action.ts b/src/app/actions/app-actions/update-app-config-action.ts index dfeee66a..c28aae99 100644 --- a/src/app/actions/app-actions/update-app-config-action.ts +++ b/src/app/actions/app-actions/update-app-config-action.ts @@ -1,7 +1,6 @@ 'use server'; import { z } from 'zod'; -import { db } from '@/server/db'; import { action } from '@/lib/safe-action'; import { revalidatePath } from 'next/cache'; import { AppServiceClass } from '@/server/services/apps/apps.service'; @@ -21,16 +20,15 @@ const input = z.object({ */ export const updateAppConfigAction = action(input, async ({ id, form }) => { try { - const appsService = new AppServiceClass(db); - + const appsService = new AppServiceClass(); await appsService.updateAppConfig(id, form); - revalidatePath('/apps'); - revalidatePath(`/app/${id}`); - revalidatePath(`/app-store/${id}`); - return { success: true }; } catch (e) { - return handleActionError(e); + return await handleActionError(e); + } finally { + revalidatePath('/apps'); + revalidatePath(`/app/${id}`); + revalidatePath(`/app-store/${id}`); } });