score:1

axios.request(config)

axios.get(url[, config])

axios.delete(url[, config])

axios.head(url[, config])

axios.options(url[, config])

axios.post(url[, data[, config]])

axios.put(url[, data[, config]])

axios.patch(url[, data[, config]])

score:1

const userDetails = {
      userid:'1235',
      username:this.state.name
    }
axios.get('/user', {
    params: userDetails
  })
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  })
  .then(function () {
    // always executed
  });  

score:1

async getNotification() {
        const userDetails = {
            userid: "1235",
            username: this.state.name
        }

        try {
            const res = axios.get('http://localhost:4000/notification/', userDetails)
            this.setState((cur) => ({...cur, notification: res.data.reverse()}));
        } catch (error) {
            console.log(error);
        }
    }

Related Query

More Query from same tag