From 3f90deb5c1c05f1cc9468091f9cba9f9335c051a Mon Sep 17 00:00:00 2001 From: Stivenjs Date: Tue, 3 Jun 2025 12:22:01 -0500 Subject: [PATCH] refactor(amplify): relocate AmplifyProvider and update import paths for configuration This commit removes the AmplifyProvider component and updates the import path for the Amplify configuration in the collection form. The configuration is now imported from a shared module, improving code organization and maintainability. --- .../collection-form/index.ts | 2 +- components/providers/AmplifyProvider.tsx | 35 ------------------- 2 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 components/providers/AmplifyProvider.tsx diff --git a/app/store/components/product-management/collection-form/index.ts b/app/store/components/product-management/collection-form/index.ts index acec19ca..1c499909 100644 --- a/app/store/components/product-management/collection-form/index.ts +++ b/app/store/components/product-management/collection-form/index.ts @@ -28,4 +28,4 @@ export type { export { filterProducts, sortProducts, getProductImageUrl, formatPrice } from './utils/productUtils' // Config -export { configureAmplify } from './config/amplifyConfig' +export { configureAmplify } from '@/lib/amplify-config' diff --git a/components/providers/AmplifyProvider.tsx b/components/providers/AmplifyProvider.tsx deleted file mode 100644 index b6ebef22..00000000 --- a/components/providers/AmplifyProvider.tsx +++ /dev/null @@ -1,35 +0,0 @@ -'use client' - -import { useEffect, useRef } from 'react' -import { configureAmplify, configureAmplifySSR } from '@/lib/amplify-config' - -interface AmplifyProviderProps { - children: React.ReactNode -} - -export function AmplifyProvider({ children }: AmplifyProviderProps) { - const isConfigured = useRef(false) - - useEffect(() => { - // Solo configurar una vez en el cliente - if (!isConfigured.current) { - if (typeof window !== 'undefined') { - configureAmplify() - } else { - configureAmplifySSR() - } - isConfigured.current = true - } - }, []) - - return <>{children} -} - -// También exportar una versión que se ejecuta inmediatamente -export function initializeAmplify() { - if (typeof window !== 'undefined') { - configureAmplify() - } else { - configureAmplifySSR() - } -}