From 9471b033f0da55db0634cdffc0e7ef4719ac35f1 Mon Sep 17 00:00:00 2001 From: JF-Cozy Date: Thu, 24 Oct 2024 14:16:09 +0200 Subject: [PATCH] feat(providers): Add Encrypted from cozy-viewer and remove it from there --- react/providers/Encrypted/index.jsx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 react/providers/Encrypted/index.jsx diff --git a/react/providers/Encrypted/index.jsx b/react/providers/Encrypted/index.jsx new file mode 100644 index 0000000000..568077a2c6 --- /dev/null +++ b/react/providers/Encrypted/index.jsx @@ -0,0 +1,25 @@ +import React, { useContext } from 'react' + +export const EncryptedContext = React.createContext() + +export const useEncrypted = () => { + const context = useContext(EncryptedContext) + + if (!context) { + throw new Error('useEncrypted must be used within a EncryptedProvider') + } + return context +} + +const EncryptedProvider = ({ url, children }) => { + const contextValue = { + url + } + return ( + + {children} + + ) +} + +export default React.memo(EncryptedProvider)