Logout from next-auth with keycloak provider not works

Issue I have a nextjs application with next-auth to manage the authentication. Here my configuration …. export default NextAuth({ // Configure one or more authentication providers providers: [ KeycloakProvider({ id: ‘my-keycloack-2’, name: ‘my-keycloack-2’, clientId: process.env.NEXTAUTH_CLIENT_ID, clientSecret: process.env.NEXTAUTH_CLIENT_SECRET, issuer: process.env.NEXTAUTH_CLIENT_ISSUER, profile:

Continue reading

NextJS SSR and Client side state

Issue I have the following nextJS app: export default function Home({ productsData }) { const [user, setUser] = useState(null); const [products, setProducts] = useState([]); useEffect(() => { if (productsData) setProducts(productsData); }, [productsData]); useEffect(() => { const userLocal = window.localStorage.getItem("user"); if

Continue reading

react datepicker default start date

Issue useEffect(() => { const loadAndSetData = async () => { setLoading(true); const startDate = moment() .startOf(‘day’) .subtract(30, ‘days’); const endDate = moment().endOf(‘day’); formRef.current.setFieldsValue({ rangePicker: [startDate, endDate], }); setLoading(false); }; }, []); Hi here is my code. I want to

Continue reading

Failed to compile src\Search.js: setEndDate, selectionRange and handSelect are not defined

Issue import React,{useState} from ‘react’ import ‘./search.css’ import "react-date-range/dist/styles.css"; import "react-date-range/dist/theme/default.css" import {DateRangePicker} from "react-date-range"; function Search() { const[startDate,setStartDate]=useState(new Date()); const[endDate,setendDate]=useState(new Date()); const selctionRange = { startdate:startDate, endDate:endDate, key:"selection", } function handleSelect(ranges){ setStartDate(ranges.seection.startDate); setEndDate(ranges.selection.endDate); } return ( <div className="search"> <DateRangePicker

Continue reading

my app routs me to a page, but i cant access it directly

Issue i have setup a link that routes me to an about page (about.js): import React,{useState,useEffect} from ‘react’; import Link from ‘next/link’ ///————————PAGES——————————-/// import {default as Main} from ‘../app/sections/Main.js’ export default function Home() { const [site, setSite] = useState(‘down’); const

Continue reading

How to convert token JWT to object in reactjs

Issue I have reactjs project, when i login i save my token to localstorage, how can i convert token JWT to object and get id_user? Thank you guys eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NCwiZW1haWwiOiJhZG1pbkBnbWFpbC5jb20iLCJhdXRob3JpemF0aW9uIjoib3duZXIiLCJpYXQiOjE2NTQ5NDkxMjksImV4cCI6MTY1NDk1MjcyOX0.5e-KzJ0Rv3iWmY5MFtEGjRXZBJNlddiZ97X8pHJD03g Decoded Solution You can also use basic JavaScript to decode it:

Continue reading

Mapping array in javacript app in a react app

Issue This is my array, I’m working on react app const categoryObj = [ { id: "463e989a-c4f2-4616-85c5-0cb610c5fff0", name: "Women", subCategory: [ { id: "91ba7308-b68e-4d0c-85d8-0cc8272c6bc8", name: "All", icon: "AllIcon" }, { id: "0e0712c5-0b5a-4d4e-acf5-3d7faf2caa2a", name: "Clothes", icon: "ClothesIcon", sections: [ { id:

Continue reading