PUT request not going through on axios

I am using MERN stack to build a simple website with CRUD functionalities
Whenever I try updating the documents , I get these logs

name 1 email 1 mem phone 1jnk bundle.js:1014:13
XMLHttpRequest { readyState: 4, timeout: 5000, withCredentials: false, upload: XMLHttpRequestUpload, responseURL: "", status: 0, statusText: "", responseType: "", response: "", responseText: "" }
bundle.js:1032:17
config 
Object { transitional: {…}, adapter: (2) […], transformRequest: (1) […], transformResponse: (1) […], timeout: 5000, xsrfCookieName: "XSRF-TOKEN", xsrfHeaderName: "X-XSRF-TOKEN", maxContentLength: -1, maxBodyLength: -1, env: {…}, … }
bundle.js:1036:15

The server is running correctly and I have also noticed that the request is not reaching the server. I tried running the PUT request on thunderclient and POSTMAN and noticed that there the request is reaching correctly and I get the correct response.

import React, { useEffect,useState } from 'react'

import axios from 'axios'

import Box from '@mui/material/Box';
import TextField from '@mui/material/TextField';
import Button from '@mui/material/Button';
import { useNavigate } from 'react-router-dom'
import SendIcon from '@mui/icons-material/Send';

const EditMembers = () => {
    const [name,setName]=useState("")
    const [email,setEmail]=useState("")
    const [phone,setPhone]=useState("")
    const [membershipID,setMembershipID]=useState("")

    useEffect(()=>{
        setMembershipID(localStorage.getItem("MembershipID"))
        setName(localStorage.getItem("Name"))
        setEmail(localStorage.getItem("Email"))
        setPhone(localStorage.getItem("Phone"))
    },[])

    const navigate = useNavigate()

    const updateMember=async()=>{
        console.log(`http://localhost:5000/members/${membershipID}`)
        console.log(name,email,membershipID,phone)
        try{
            const res = await axios.put(`http://localhost:5000/members/${membershipID}`,
            {
                name,email,membershipID,phone
            },
            {timeout:5000,  })

            console.log(res)
            navigate('/members')
        } catch(error) {
                if (error.response) {
                    console.log("errror",error.response.data);
                    console.log(error.response.status);
                    console.log(error.response.headers);
                  } else if (error.request) {
                    console.log(error.request);
      
                  } else {
                    console.log('Error', error.message);
                                      
                  }
                  console.log('config',error.config);
            }
         }
        
    

    return (
        <>
    
    <Box onSubmit={updateMember}
      component="form"
      sx={{
        display: 'flex',
        flexDirection: 'column',
        alignItems: 'center',
        '& .MuiTextField-root': { m: 1, width: '25ch' },
      }}
      noValidate
      autoComplete="off"
    >
      <div>
        <TextField
          id="outlined-multiline-flexible"
          type="text"
          multiline
          maxRows={4}
          label="Name"
          value={name}
          required
          onChange={(e)=>setName(e.target.value)}
        />
        <TextField
          id="outlined-multiline-flexible"
          type="email"
          multiline
          maxRows={4}
          value={email}
          label="Email"
          required
          onChange={(e)=>setEmail(e.target.value)}
        />
        <TextField
          id="outlined-multiline-flexible"
          multiline
          maxRows={4}
          label="Phone"
          value={phone}
          onChange={(e)=>setPhone(e.target.value)}
          required
        />
        <TextField
          id="outlined-multiline-flexible"
          multiline
          maxRows={4}
          label="MembershipID"
          value={membershipID}
          onChange={(e)=>setMembershipID(e.target.value)}
          required
        />
      </div>

      
 
      
      <Button  type="submit" size="large" variant="contained" color='success' endIcon={<SendIcon />} sx={{ mt: 2 }}>
        Submit
      </Button>
      </Box>
        </>
    )
}

export default EditMembers

How can I change my bootstrap rotating logo carousel from advancing 1 image at a time to 4? (Ex: when clicking new arrow make it go from 1-4 to 5-8)

I created a rotating logo module in WordPress using a bootstrap carousel found here: https://codepen.io/alephx/pen/EmZKpd. I have the carousel working as intended in terms of showing the logos and rotating but I am having trouble figuring out how to modify the script or code to make it so when it rotates it goes from showing images 1-4 to 5-8 (rather than going from 1-4 to 2-5 to 3-6 one at a time). Can anyone help me figure out what should change to make it so that clicking the arrows/letting the carousel auto rotate will move the logos/images by 4 instead of 1 at a time?

HTML:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <div class="container-fluid" style="display:flex; justify-content:center;flex-wrap:wrap;">

  
      <div class="col-md-12 text-center"><h3 style="padding-bottom:30px;">Trusted Partners</h3></div>
<div class="col-md-6 col-md-offset-3">
<div class="carousel slide" data-ride="carousel" data-type="multi" data-interval="9000" id="myCarousel">
  <div class="carousel-inner">
    <div class="item active">
      <div class="col-md-3 col-sm-6 col-xs-12"> <?php  echo wp_get_attachment_image($content['logo_1'], 'large'); ?></div>
    </div>

      <?php if( have_rows('flex_content') ):?>
      <?php while( have_rows('flex_content') ): the_row();?>
      <?php if (get_row_layout() == 'rotating_carousel'): $columns = get_sub_field( 'carousel_repeater' );?>

      <?php if (have_rows('carousel_repeater') ): while( have_rows('carousel_repeater') ): the_row();
      $image = get_sub_field('image');

      ?> 

                    
    <div class="item">
      <div class="col-md-3 col-sm-6 col-xs-12">     <img src="<?php echo $image; ?>"></div>
    </div>
      
      <?php endwhile; ?>
      <?php endif; ?>
      <?php endif;?>
      <?php endwhile;?>
      <?php endif;?>
    
  </div>
  <a class="left carousel-control" id="left-carousel-control" href="#myCarousel" data-slide="prev"></a>
  <a class="right carousel-control" id="right-carousel-control"  href="#myCarousel" data-slide="next"></a>
</div>
</div> 

CSS:

 <style>
      .carousel-control              { width:  4%; }
.carousel-control.left,.carousel-control.right {margin-left:15px;background-image:none;}
@media (max-width: 767px) {
    .carousel-inner .active.left { left: -100%; }
    .carousel-inner .next        { left:  100%; }
    .carousel-inner .prev        { left: -100%; }
    .active > div { display:none; }
    .active > div:first-child { display:block; }

}
@media (min-width: 767px) and (max-width: 992px ) {
    .carousel-inner .active.left { left: -50%; }
    .carousel-inner .next        { left:  50%; }
    .carousel-inner .prev        { left: -50%; }
    .active > div { display:none; }
    .active > div:first-child { display:block; }
    .active > div:first-child + div { display:block; }
}
@media (min-width: 992px ) {
    .carousel-inner .active.left { left: -50%; }
    .carousel-inner .next        { left:  50%; }
    .carousel-inner .prev        { left: -50%; }    
}
          
          @media (max-width:767px) {
              .carousel-inner>.item.active, .carousel-inner>.item.next.left, .carousel-inner>.item.prev.right { left: 8%; }
          }
        
        
          
          .col-md-offset-3 {margin-left:0%;width:70%;}

#right-carousel-control{
    content:'';
  background: url(http://sitexstaging.wpengine.com/wp-content/uploads/2023/06/right-arrow.webp);
    vertical-align: middle;
    background-size: 50px;
    background-position: center;
    background-repeat: no-repeat;
    margin-right:-50px;

}
          
          #left-carousel-control {
                      
          -webkit-transform: scaleX(-1);
  transform: scaleX(-1); 
               background: url(http://sitexstaging.wpengine.com/wp-content/uploads/2023/06/right-arrow.webp);
    vertical-align: middle;
    background-size: 50px;
    background-position: center;
    background-repeat: no-repeat;
              margin-left:-50px;
          }  
          
          @media (max-width:600px) {
              #left-carousel-control, #right-carousel-control {width:40px}
          }
      </style>

Javasript:

<script>
      $('.carousel[data-type="multi"] .item').each(function(){
  var next = $(this).next();
  if (!next.length) {
    next = $(this).siblings(':first');
  }
  next.children(':first-child').clone().appendTo($(this));
  
  for (var i=0;i<2;i++) {
    next=next.next();
    if (!next.length) {
        next = $(this).siblings(':first');
    }
    
    next.children(':first-child').clone().appendTo($(this));
  }
});
      </script>

The carousel works to rotate logos/images 1 at a time when auto rotating or when clicking the advance/previous arrows. I want it to rotate 4 at a time.

I’ve tried to adjust the script and tried researching online but wasn’t sure what determines how many images are rotated

angular: select all checkbox

I have an existing angular application and I am trying to add a ‘select all’ checkbox in the header of a table. I cant manage to make it work… My closest effor to success is this one, but it when clicked it checks all checkboxes even I have 1000 , despite that I have hardcoded a counter to check only the first 10 ones… And eventhough it checks all it submit the forms with only the first 10!! (it sends an email to selected accounts but this is working fine…). so here is my code:
html:

 <div class="table-responsive">
                                <table mat-table [dataSource]="dataSource">  

                                    <ng-container matColumnDef="IsSelected"><!--SUP-1176 start-->
                                        <th mat-header-cell *matHeaderCellDef mat-sort-header class="nowrap"><mat-checkbox style="left:-16px;" (change)="ToggleCheckAll()"></mat-checkbox>Επιλογή Κάρτας </th><!--SUP-1176 end-->
                                        <td mat-cell *matCellDef="let element; let i = index;">
                                            <mat-checkbox [checked]="imchecked" class="example-margin" (change)="ToggleChecked(element)">
                                            </mat-checkbox>
                                        </td>
                                    </ng-container> .....

and the javascript .ts code:

public ToggleCheckAll(){

    let i = 0;
    this.cards.forEach(c=>{ 
      if(i < 9){
        i++;
        this.imchecked = !this.imchecked; 
   
        this.ToggleChecked(c);
      }
      
    });
 
  }
//SUP-1176 end
  //changes selected status from object
  public ToggleChecked(c:CardModule.Card){


    if(c.IsSelected==null || c.IsSelected==undefined){
      c.IsSelected=false;
    }

    c.IsSelected=!c?.IsSelected;

    if(c?.IsSelected){ 
      this.selectedCards=[...this.selectedCards,c.Id.toString()];
    }
    else{
 
      var index:number=-1;

      for(var i=0;i<this.selectedCards.length;i++){
        if(c.Id.toString()==this.selectedCards[i]){
          index=i;
        }
      }

      if(index>-1){//console.log('4');
        this.selectedCards.splice(index,1);
      }
    }
  }

I am trying to select only the rows in the current page but it selects all… despite the pagination

Having a problem with getting the providers

how do i get these providers?

so i was following the javascript mastery tutorial and i did the exact same thing , but this useEffect to get the providers isnt working ( i tried alerting it to see it keeps showing null)

here’s the piece of code of the providers , tell me what could be wrong

const [providers, setProviders] = useState(null);
 const [toggleDropdown, setToggleDropdown] = useState(false);

 useEffect(() => {
   const setUpProviders = async () => {
     const response = await getProviders();
     setProviders(response);
   };

   setUpProviders();
 }, []);

Css overflow:hidden makes part of children components invisible even after returning them to visible area

I have a message box banner on top of my screen with the following styles (I’m using React + Material UI):

  style={{
    display: "flex",
    flexDirection: "row",
    justifyContent: "flex-start",
    textAlign: "left",
    flexGrow: 1,
    overflow: "hidden",
    height: "100%",
  }}

The children components have the following animation:

  "scroll-text": {
    width: "80%",
    animation: `$marquee ${value}s linear infinite`,
    animationPlayState: "running",
    "&:hover": {
      animationPlayState: "paused",
    },
    "&focus-within": {
      animationPlayState: "paused",
    },
  },

 "@keyframes marquee": {
    "0%": { transform: "translateX(0);" },
    "100%": { transform: "translateX(-100%);" },
  },

The animation works fine, but the after the system has enough children components to surpass the width of the container, the new children components appear partially cut or even don’t appear (check in the attached image that after the second empty circle there is the beginning of the component but the rest doestn’t appear
enter image description here

Building a React app that gets error loading data from API

So I’m doing this assignment in a React/JS course and I have to fetch data from open library.. I’ve built this function below that returns an object and a table which should load a book once you search for it.. but I just get “error failed to load” I can’t find anything else in my console on what the error could be.

In my index.js I have the following:

import React from 'react';
import ReactDOM from 'react-dom/client';
import './style.css';
import App from './App';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<App />);
import React, { useState } from 'react';
import React, { strictMode } from 'react';

function App() {
  const [searchTerm, setSearchTerm] = useState('');
  const [books, setBooks] = useState([]);
  const [selectedBook, setSelectedBook] = useState(null);

  const handleInputChange = (event) => {
    setSearchTerm(event.target.value);
  };

  const searchBooks = () => {
    fetch(`http://openlibrary.org/search.json?title=${searchTerm}`)
      .then((response) => response.json())
      .then((data) => {
        const slicedBooks = data.docs.slice(0, 30);
        setBooks(slicedBooks);
      })
      .catch((error) => {
        console.error('Error:', error);
      });
  };

  const showBookDetails = (book) => {
    setSelectedBook(book);
  };

  return (
    <div>
      <div>
        <input type="text" value={searchTerm} onChange={handleInputChange} />
        <button onClick={searchBooks}>Search</button>
      </div>
      <table>
        <thead>
          <tr>
            <th>Author</th>
            <th>Title</th>
            <th>First Publish Year</th>
          </tr>
        </thead>
        <tbody>
          {books.map((book) => (
            <tr key={book.key} onClick={() => showBookDetails(book)}>
              <td>{book.author_name ? book.author_name[0] : 'Unknown'}</td>
              <td>{book.title}</td>
              <td>{book.first_publish_year}</td>
            </tr>
          ))}
        </tbody>
      </table>
      {selectedBook && (
        <div>
          <h2>Book Details</h2>
          <p>
            <strong>Title:</strong> {selectedBook.title}
          </p>
          {selectedBook.author_name && (
            <p>
              <strong>Author:</strong> {selectedBook.author_name.join(', ')}
            </p>
          )}
          {selectedBook.publisher && (
            <p>
              <strong>Publisher:</strong> {selectedBook.publisher.join(', ')}
            </p>
          )}
          {selectedBook.language && (
            <p>
              <strong>Language:</strong> {selectedBook.language.join(', ')}
            </p>
          )}
          {selectedBook.subject && (
            <p>
              <strong>Subjects:</strong> {selectedBook.subject.join(', ')}
            </p>
          )}
        </div>
      )}
    </div>
  );
}

export default App;

You don’t use prompt [closed]

I do the exercices that I have to do ink order to enter a formation on the website 3W Academy.

The exercice I’m at consist on creation 3 variables, affect the response with a window.prompt, and finally make the ersponse in lower cases characters.

Here s what I have at the begenning of the exercises :

'use strict';

// Vous devez déclarer 3 variables,

// demandez à l'utilisateur son choix (pierre, feuille ou ciseaux)

// modifier la casse en minusule

And what I wrote of code :

'use strict';

// Vous devez déclarer 3 variables,
var player, computer, random;
// demandez à l'utilisateur son choix (pierre, feuille ou ciseaux)
player = window.prompt("Pierre, papier ou ciseaux ?").toLowerCase();

// modifier la casse en minusule

I already tried to delete the variable player, and do let player = prompt("Pierre, papier ou ciseaux ?").toLowerCase(); and I also tried for both cases a default response in the prompt; but each time I try to validate the exercice, it say that I didn’t used prompt.

React select infinite scroll jumping issue

I’m trying to create an infinite scroll dropdown using react-window-infinite-loader and react-select, and I found examples online such as this one. They all have the same issue- once the user reaches the bottom of the list and more rows are fetched, the scroll jumps to the start. I’ve been trying to debug exactly which re-render is causing the jump but can’t seem to fix the issue.
Also, I found this other npm package that seems to have solved the issue, but I can’t use it since the components are not customizable enough. I’ve been stuck on this for a while and I’ve lost hope.

The first example link is the exact code that I’m using (with a different API call but same logic). Does anyone have an idea of a hack or any way to fix this?

How to check if the value of div id is equal to the value in localstorage

I need to validate a div element ID with the localstorage value. If true I need to show an error message. When I console.log the value of each they are the same, but when I console.log to compare both it returns false.

I don’t know what I am doing wrong.

<div id="test"></div>

$('button').on('click', function(){
    var parentEl = $('div').attr('id');
    localStorage.setItem('contentid', 'test');
    if($(parentEl) == localStorage.getItem('contentid')) {
        console.log('id === localstorage', $(parentEl) == localStorage.getItem('contentid'));
        console.log('local', localStorage.getItem('contentid'));
        console.log('id', parentEl);
        console.log('cant go next');
    } else {
        console.log('go next');
    }
});