From de8afe83defb1313b6f93dbd6c466404d7f42243 Mon Sep 17 00:00:00 2001 From: H4K3R13 Date: Sun, 10 Mar 2024 18:10:35 +0530 Subject: [PATCH] Added API to check the the user is already added or not --- apis/searchUserID.l2 | 8 ++++++++ src/App.jsx | 28 ++++++++++++++++++++++------ src/components/Form.jsx | 4 ++-- src/components/Login.jsx | 4 +--- src/components/SearchBar.jsx | 4 +++- src/components/api.js | 19 +++++++++++++++++++ 6 files changed, 55 insertions(+), 12 deletions(-) create mode 100644 apis/searchUserID.l2 diff --git a/apis/searchUserID.l2 b/apis/searchUserID.l2 new file mode 100644 index 0000000..bdf915b --- /dev/null +++ b/apis/searchUserID.l2 @@ -0,0 +1,8 @@ +GET + +https://api.baserow.io/api/database/rows/table/262939/?user_field_names=true&filter__field_1868162__equal=11769 + +Authorization: Token HgOfMk9hNi5HoAIRHhdlzGgsR0e6WJdG + + + diff --git a/src/App.jsx b/src/App.jsx index b04e015..1d05649 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,16 +1,32 @@ -import Navbar from "./components/Navbar"; -import Form from "./components/Form"; -import SearchBar from "./components/SearchBar"; import "./App.css"; import Login from "./components/Login"; -import { GoogleOAuthProvider } from "@react-oauth/google"; +import { useEffect } from 'react'; + function App() { + + useEffect(() => { + const handleFocus = () => { + console.log('Focused'); + }; + + const handleBlur = () => { + console.log('Blurred'); + }; + + window.addEventListener('focus', handleFocus); + window.addEventListener('blur', handleBlur); + + return () => { + window.removeEventListener('focus', handleFocus); + window.removeEventListener('blur', handleBlur); + }; + }, []) + + return ( <> - {/* */} - {/* */}; ); } diff --git a/src/components/Form.jsx b/src/components/Form.jsx index 53800af..dda04e3 100644 --- a/src/components/Form.jsx +++ b/src/components/Form.jsx @@ -13,8 +13,7 @@ const Form = (props) => { const [activeTab, setActiveTab] = useState(""); const [user, setUser] = useState(); - const userid = props.user - console.log("User in From", props.user, userid) + console.log("User in From", props.user) //Gets current Tab's URL async function getCurrentTab() { @@ -43,6 +42,7 @@ const Form = (props) => { getCurrentTab(); //setActiveTab("https://example.com"); //used during development fetchData(); + setUser(props.user) }, []); const handleUrlChange = (e) => { diff --git a/src/components/Login.jsx b/src/components/Login.jsx index 39d72bf..36aab95 100644 --- a/src/components/Login.jsx +++ b/src/components/Login.jsx @@ -1,7 +1,5 @@ -import React, { useState } from "react"; +import { useState } from "react"; import Home from "./Home"; -import { GoogleLogin } from "@react-oauth/google"; -import { jwtDecode } from "jwt-decode"; import { Button } from "@mui/material"; import { login } from "./api"; import Navbar from "./Navbar"; diff --git a/src/components/SearchBar.jsx b/src/components/SearchBar.jsx index a3ab0b8..f24b59d 100644 --- a/src/components/SearchBar.jsx +++ b/src/components/SearchBar.jsx @@ -58,7 +58,9 @@ const SearchBar = () => { return (
- Select the required tags to explore you bookmarks! + + Select the required tags to explore your bookmarks! +