Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React, { useEffect, useState } from 'react';
import { prepareKey, TweekProvider as OriginalTweekProvider } from 'react-tweek';
import { TweekRepository } from 'tweek-local-cache';
import { equals } from 'ramda';
import { tweekClient } from '../utils/tweekClients';
import { useCurrentUser } from './CurrentUser';
prepareKey('@tweek/editor/_');
const toTweekContext = ({ User }) => ({ tweek_editor_user: User });
export const TweekProvider = ({ children }) => {
const [tweekRepository, setTweekRepository] = useState();
const user = useCurrentUser();
useEffect(() => {
if (!user) {
return;
}
const context = toTweekContext(user);
if (tweekRepository) {