From 007b09a51f39345e79d3466eceb48d7780dcb70e Mon Sep 17 00:00:00 2001 From: tigran Date: Fri, 5 Jan 2024 07:54:20 +0400 Subject: [PATCH] add request provider --- .gitignore | 3 +- index.html | 2 +- src/components/Reactions/index.js | 9 +--- src/index.js | 27 ++++++------ src/providers/Comments/index.js | 59 +++++++++++++-------------- src/providers/Reactions/index.js | 43 ++++++++----------- src/providers/Requests/index.js | 68 +++++++++++++++++++++++++++++++ 7 files changed, 133 insertions(+), 78 deletions(-) create mode 100644 src/providers/Requests/index.js diff --git a/.gitignore b/.gitignore index 7e047df..aab3792 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ node_modules .parcel-cache tmp yarn.lock -dist \ No newline at end of file +dist +yarn-error.log diff --git a/index.html b/index.html index 04bb909..40a8404 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,7 @@
- + \ No newline at end of file diff --git a/src/components/Reactions/index.js b/src/components/Reactions/index.js index 71e2340..715e308 100644 --- a/src/components/Reactions/index.js +++ b/src/components/Reactions/index.js @@ -1,6 +1,4 @@ import React, { useEffect, useCallback } from 'react'; -import FingerprintJS from '@fingerprintjs/fingerprintjs'; -import axios from 'axios'; import { ContentBubbleContainer, ContentBubble, ContentBubbleCount } from './style'; import { useReactionDispatch, useReactionState } from 'providers/Reactions'; @@ -14,12 +12,7 @@ function ReactionsComponent({ emotions }) { const onReact = useCallback(reaction => actions.react(reaction), []); useEffect(() => { - FingerprintJS.load().then(fp => { - fp.get().then(({ visitorId }) => { - axios.defaults.headers.common['fingerprint'] = visitorId; - actions.getReactions(); - }); - }); + actions.getReactions(); }, []); return ( diff --git a/src/index.js b/src/index.js index 42d80a1..3e0cfc0 100644 --- a/src/index.js +++ b/src/index.js @@ -4,6 +4,7 @@ import CommentsProvider from 'providers/Comments'; import ReactionsProvider from 'providers/Reactions'; import LanguageProvider from 'providers/Language'; import ThemeProvider from 'providers/Theme'; +import RequestProvider from 'providers/Requests'; import Editor from 'components/Editor'; import Comments from 'components/Comments'; @@ -20,18 +21,20 @@ if (commentsElement) { ReactDOM.render( - - {emotions && ( - - - - )} - - - - -