CodeWithHarry / iNotebook-React

INotebook is a React Application for managing personal notes on the cloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

help needed

RAHULBAWA777 opened this issue · comments

POST http://localhost:5000/api/notes/addnote 400 (Bad Request)

VM275:1 Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0

I am getting these two errors ...please anyone help.

hello @RAHULBAWA777 can you clearly describe the error.

hello @RAHULBAWA777 can you clearly describe the error.

Bro everything is working great only when I'm trying to add a note I'm getting error... Because my request is being send in xml format idk why... I have mentioned json format in code still I'm getting that error

can you share code snippet of your api request

Screenshot (250)
Screenshot (251)
Screenshot (252)
Screenshot (253)
Screenshot (254)

here you go man ....please do come up with a solution man!!!

can you share code snippet of your api request

check out these ss

@RAHULBAWA777 I was unable to repoduce the error can you drop your github repo link so I will try with it

@RAHULBAWA777 I was unable to repoduce the error can you drop your github repo link so I will try with it

here you go - https://github.com/RAHULBAWA777/cloudbook

@RAHULBAWA777

Their is issue in code it is working fine now

I have replaced the following function

addNote in file src/context/notes/NoteState.js

const addNote = async (title, description, tag) => {
    // API CALL
    // console.log()
    const response = await fetch(`${host}/api/notes/addnote`, {    
   method: 'POST',
      headers: {
        "Content-Type": "application/json",
        "auth-token": localStorage.getItem('token')
      },
      body: JSON.stringify({"title": title, "description": description, "tag": tag}) // body data type must match "Content-Type" header
    });
    const note =await response.json();
  
    setNotes(notes.concat(note))
  }

I have changed the body

@RAHULBAWA777 I was unable to repoduce the error can you drop your github repo link so I will try with it

here you go - https://github.com/RAHULBAWA777/cloudbook

bro you a saviour thank you so much .... throw me your social ...i wanna talk

@RAHULBAWA777 I was unable to repoduce the error can you drop your github repo link so I will try with it

here you go - https://github.com/RAHULBAWA777/cloudbook

bro you a saviour thank you so much .... throw me your social ...i wanna talk

Bro My discord handle is pavan#8786 we can connect their

i need a help...

Hello @rubulgithub can you ask your question

Screenshot (86)

Hi @annanayaggarwal please refer to earlier comments if not solved check the network tab for exact error.. we can connect over discord pavanakurathi or pavansssai2001@gmail.com

ok sure