diff --git a/package-lock.json b/package-lock.json index d90a99be..eb5c2477 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,6 +41,7 @@ "@vitejs/plugin-react": "^4.2.1", "all-contributors-cli": "^6.26.1", "autoprefixer": "^10.4.16", + "concurrently": "^8.2.2", "eslint": "^8.57.0", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", @@ -2691,6 +2692,194 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "node_modules/concurrently": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-8.2.2.tgz", + "integrity": "sha512-1dP4gpXFhei8IOtlXRE/T/4H88ElHgTiUzh71YUmtjTEHMSRS2Z/fgOxHSxxusGHogsRfxNq1vyAwxSC+EVyDg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.2", + "date-fns": "^2.30.0", + "lodash": "^4.17.21", + "rxjs": "^7.8.1", + "shell-quote": "^1.8.1", + "spawn-command": "0.0.2", + "supports-color": "^8.1.1", + "tree-kill": "^1.2.2", + "yargs": "^17.7.2" + }, + "bin": { + "conc": "dist/bin/concurrently.js", + "concurrently": "dist/bin/concurrently.js" + }, + "engines": { + "node": "^14.13.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/concurrently/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/concurrently/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/concurrently/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/concurrently/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/concurrently/node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dev": true, + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/concurrently/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/concurrently/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/concurrently/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/convert-source-map": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", @@ -2770,6 +2959,22 @@ "node": ">=4" } }, + "node_modules/date-fns": { + "version": "2.30.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", + "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.21.0" + }, + "engines": { + "node": ">=0.11" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/date-fns" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -6318,6 +6523,15 @@ "node": ">=8" } }, + "node_modules/shell-quote": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz", + "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/side-channel": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.5.tgz", @@ -6359,6 +6573,12 @@ "node": ">=0.10.0" } }, + "node_modules/spawn-command": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2.tgz", + "integrity": "sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ==", + "dev": true + }, "node_modules/stackblur-canvas": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/stackblur-canvas/-/stackblur-canvas-2.7.0.tgz", @@ -6752,6 +6972,15 @@ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", "dev": true }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "bin": { + "tree-kill": "cli.js" + } + }, "node_modules/ts-interface-checker": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", diff --git a/package.json b/package.json index d0e1fe4d..d81559c1 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "dev": "vite", "build": "vite build", "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", - "preview": "vite preview" + "preview": "vite preview", + "both": "concurrently \"npm run dev\" \"nodemon ./server/server.js\"" }, "dependencies": { "@emotion/react": "^11.11.3", @@ -43,6 +44,7 @@ "@vitejs/plugin-react": "^4.2.1", "all-contributors-cli": "^6.26.1", "autoprefixer": "^10.4.16", + "concurrently": "^8.2.2", "eslint": "^8.57.0", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", diff --git a/server/.gitignore b/server/.gitignore new file mode 100644 index 00000000..2c43a2a7 --- /dev/null +++ b/server/.gitignore @@ -0,0 +1,27 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +server/node_modules +server/.env +dist +dist-ssr +*.local +.env + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/src/components/Banner/HomeBanner.jsx b/src/components/Banner/HomeBanner.jsx index 855aa1f3..e5f2d613 100644 --- a/src/components/Banner/HomeBanner.jsx +++ b/src/components/Banner/HomeBanner.jsx @@ -3,9 +3,9 @@ import "./homebanner.css"; import { useTheme } from "../../context/ThemeContext"; import { FaPlay, FaPlus, FaRegHeart } from "react-icons/fa"; import { LuMessageSquare, LuPen } from "react-icons/lu"; -import { MdOutlineRemoveRedEye } from "react-icons/md"; import { HiOutlineMail } from "react-icons/hi"; -import VisibilityOffIcon from "@mui/icons-material/VisibilityOff"; +import { MdOutlineRemoveRedEye } from "react-icons/md"; +import { AiOutlineEyeInvisible } from "react-icons/ai"; import { useForm } from "react-hook-form"; import { useNavigate, Link } from "react-router-dom"; import axios from "axios"; @@ -29,15 +29,11 @@ const HomeBanner = () => { const { updateLoggedIn, showToast } = useAppContext(); const { register, handleSubmit } = useForm(); - + const apiUrl = import.meta.env.VITE_API_URL; const { mutate: loginUserMutate, isPending: isLoginPending } = useMutation({ - mutationFn: (user) => - axios.post( - `${apiUrl}/api/users/login`, - user - ), + mutationFn: (user) => axios.post(`${apiUrl}/api/users/login`, user), }); const onSubmit = handleSubmit(({ email, password }) => { @@ -251,7 +247,7 @@ const HomeBanner = () => { ) : ( {" "} - + )} diff --git a/src/components/UserProfile/UserProfile.jsx b/src/components/UserProfile/UserProfile.jsx index 44240e62..7802a686 100644 --- a/src/components/UserProfile/UserProfile.jsx +++ b/src/components/UserProfile/UserProfile.jsx @@ -1,63 +1,58 @@ -import { Avatar, Paper } from '@mui/material' -import React from 'react' - +import React from "react"; function stringToColor(string) { - let hash = 0; - let i; - - /* eslint-disable no-bitwise */ - for (i = 0; i < string.length; i += 1) { - hash = string.charCodeAt(i) + ((hash << 5) - hash); - } - - let color = '#'; - - for (i = 0; i < 3; i += 1) { - const value = (hash >> (i * 8)) & 0xff; - color += `00${value.toString(16)}`.slice(-2); - } - /* eslint-enable no-bitwise */ - - return color; + let hash = 0; + let i; + + /* eslint-disable no-bitwise */ + for (i = 0; i < string.length; i += 1) { + hash = string.charCodeAt(i) + ((hash << 5) - hash); + } + + let color = "#"; + + for (i = 0; i < 3; i += 1) { + const value = (hash >> (i * 8)) & 0xff; + color += `00${value.toString(16)}`.slice(-2); + } + /* eslint-enable no-bitwise */ + + return color; } function stringAvatar(name) { - return { - sx: { - bgcolor: stringToColor(name), - }, - children: name.split(' ').length > 1 ? `${name.split(' ')[0][0]}${name.split(' ')[1][0]}` : `${name.split(' ')[0][0]}`, - }; + return { + sx: { + bgcolor: stringToColor(name), + }, + children: + name.split(" ").length > 1 + ? `${name.split(" ")[0][0]}${name.split(" ")[1][0]}` + : `${name.split(" ")[0][0]}`, + }; } -function UserProfile({userName, userAvatar}) { - +function UserProfile({ userName, userAvatar }) { return ( - -
- {userName} + <> +
+
+ {userName}
- {userAvatar ? UI : } - - ) + {userAvatar ? ( + Avatar + ) : ( +
+ {userName.charAt(0)} +
+ )} +
+ + ); } -export default UserProfile \ No newline at end of file +export default UserProfile; diff --git a/src/pages/Authentication/Login.jsx b/src/pages/Authentication/Login.jsx index e02404c3..eb6f0fa1 100644 --- a/src/pages/Authentication/Login.jsx +++ b/src/pages/Authentication/Login.jsx @@ -4,8 +4,8 @@ import { useNavigate, Link } from "react-router-dom"; import { useForm } from "react-hook-form"; import loginImg from "../../assets/register.jpg"; import { PasswordIcon, MailIcon } from "../../assets/RegisterIcons"; -import VisibilityIcon from "@mui/icons-material/Visibility"; -import VisibilityOffIcon from "@mui/icons-material/VisibilityOff"; +import { MdOutlineRemoveRedEye } from "react-icons/md"; +import { AiOutlineEyeInvisible } from "react-icons/ai"; import { useTheme } from "../../context/ThemeContext"; import "./auth.css"; import { useAppContext } from "../../context/AppContext"; @@ -23,15 +23,11 @@ const Login = () => { handleSubmit, formState: { errors }, } = useForm(); - + const apiUrl = import.meta.env.VITE_API_URL; const { mutate: loginUserMutate, isPending: isLoginPending } = useMutation({ - mutationFn: (user) => - axios.post( - `${apiUrl}/api/users/login`, - user - ), + mutationFn: (user) => axios.post(`${apiUrl}/api/users/login`, user), }); const onSubmit = handleSubmit(({ email, password }) => { @@ -94,11 +90,15 @@ const Login = () => { })} />
{errors.password && ( diff --git a/src/pages/Authentication/Register.jsx b/src/pages/Authentication/Register.jsx index 942fe64e..8af5c76b 100644 --- a/src/pages/Authentication/Register.jsx +++ b/src/pages/Authentication/Register.jsx @@ -3,8 +3,8 @@ import axios from "axios"; import { useNavigate, Link } from "react-router-dom"; import { useForm } from "react-hook-form"; import registerImg from "../../assets/register.jpg"; -import VisibilityIcon from "@mui/icons-material/Visibility"; -import VisibilityOffIcon from "@mui/icons-material/VisibilityOff"; +import { MdOutlineRemoveRedEye } from "react-icons/md"; +import { AiOutlineEyeInvisible } from "react-icons/ai"; import { UsernameIcon, PasswordIcon, @@ -30,16 +30,12 @@ const Register = () => { handleSubmit, formState: { errors }, } = useForm(); - + const apiUrl = import.meta.env.VITE_API_URL; const { mutate: registerUserMutate, isPending: isRegisterPending } = useMutation({ - mutationFn: (user) => - axios.post( - `${apiUrl}/api/users/register`, - user - ), + mutationFn: (user) => axios.post(`${apiUrl}/api/users/register`, user), }); const onSubmit = handleSubmit( @@ -155,11 +151,15 @@ const Register = () => { })} /> {errors.password && ( @@ -181,11 +181,15 @@ const Register = () => { })} /> {errors.confirmPassword && ( diff --git a/src/pages/Features/Features.jsx b/src/pages/Features/Features.jsx index 8280f2ab..915ef13b 100644 --- a/src/pages/Features/Features.jsx +++ b/src/pages/Features/Features.jsx @@ -1,12 +1,8 @@ -import Grid from "@mui/system/Unstable_Grid"; import img1 from "../../assets/Features/img1.png"; import img2 from "../../assets/Features/img2.png"; import { useTheme } from "../../context/ThemeContext"; import { Link } from "react-router-dom"; - import { FaArrowDown } from "react-icons/fa"; -import { Divider } from "@mui/material"; - import "./features.css"; const Features = () => { @@ -33,7 +29,7 @@ const Features = () => { - +
{ {" "} - +
{ - const [lines, setLines] = useState([]); const [brushSz, setBrushSz] = useState(2); const [selectedTool, setSelectedTool] = useState("brush"); @@ -53,9 +52,6 @@ const Sketchbook = () => { const [recordRTC, setRecordRTC] = useState(null); const { isDarkMode } = useTheme(); - - - // Drawing event handlers const handleMouseDown = (e) => { @@ -236,7 +232,7 @@ const Sketchbook = () => { { ref={stageRef} > + {images.map((imageData, index) => ( + + ))} - {images.map((imageData, index) => ( - - ))} - {lines.map((line, i) => ( { * color picker only for the brush and eraser tools */ ["brush", "eraser"].includes(tool.content) ? ( - - + {/* { @@ -317,7 +307,17 @@ const Sketchbook = () => { }} > {tool.icon} - + */} + { placement="left" sx={{ zIndex: 100 }} > - +

Brush size: {brushSz}

- +
+ setBrushSz(e.target.value)} + style={{ + // Customize the slider thumb size + "--thumb-size": "20px", // Adjust the size as needed + // Customize the slider thumb color + "--thumb-color": "blue", // Adjust the color as needed + }} + /> + +
{selectedTool === "brush" ? ( @@ -348,90 +367,124 @@ const Sketchbook = () => { />
) : null} - setToolsPopoverEl(null)} > - -
+ +
) : ( - setSelectedTool(tool.content)} > {tool.icon} - + ) )} - { - const updatedImages = imageList.map((imageData) => { - const imageElement = new window.Image(); - imageElement.src = imageData.data_url; - return imageElement; - }); - setImages(updatedImages); - }} - maxNumber={maxNumber} - dataURLKey="data_url"> - {({ - imageList, - onImageUpload, - isDragging, - dragProps, - })=>( -
- - - - - -
- - )} -
- handleClear()} title="Clear"> - - - - handleUndo()} title="Undo"> - - - - handleRedo()} title="Redo"> - - - - handleDownload(["jpg", "png", "jpeg"])} title="Download"> - - - - { + const updatedImages = imageList.map((imageData) => { + const imageElement = new window.Image(); + imageElement.src = imageData.data_url; + return imageElement; + }); + setImages(updatedImages); + }} + maxNumber={maxNumber} + dataURLKey="data_url" + > + {({ imageList, onImageUpload, isDragging, dragProps }) => ( +
+ +
+ )} + + + + + + + + + + - - - + - - {recording ? : } - + {recording ? ( + + ) : ( + + )} + diff --git a/src/pages/Sketchbook/data.jsx b/src/pages/Sketchbook/data.jsx index 0f9d4101..2ce3b8d2 100644 --- a/src/pages/Sketchbook/data.jsx +++ b/src/pages/Sketchbook/data.jsx @@ -6,31 +6,31 @@ export const toolsData = [ { id: 1, title: "Selection", - icon: , + icon: , content: "selection", }, { id: 2, title: "Draw", - icon: , + icon: , content: "brush", }, { id: 3, title: "Eraser", - icon: , + icon: , content: "eraser", }, { id: 4, title: "Shapes", - icon: , + icon: , content: "shapes", }, { id: 5, title: "Text", - icon: , + icon: , content: "text", }, ]; diff --git a/src/routes/PrivateRoute.jsx b/src/routes/PrivateRoute.jsx index 34638e6d..0dcab431 100644 --- a/src/routes/PrivateRoute.jsx +++ b/src/routes/PrivateRoute.jsx @@ -10,16 +10,13 @@ const PrivateRoute = ({ children }) => { const { error, isLoading } = useQuery({ queryKey: ["token"], queryFn: () => - axios.get( - `${apiUrl}/api/users/validateToken`, - { - headers: { - Authorization: `Bearer ${ - localStorage && localStorage.getItem("token") - }`, - }, - } - ), + axios.get(`${apiUrl}/api/users/validateToken`, { + headers: { + Authorization: `Bearer ${ + localStorage && localStorage.getItem("token") + }`, + }, + }), enabled: !!localStorage, });