question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to post data using axios with orderBy and with params (here I am using param for authentication to access firebase)

See original GitHub issue

I used this code, please tell me how to use in right way-

export function sendRequest(RECEIVERUID, senderUid,TOKEN) { const request = axios.post(${FIREBASE}/coordinates.json?orderBy=\"uid\"&equalTo=\"${RECEIVERUID}\",{ params:{ auth : ${TOKEN}, }, data:{ req: senderUid } }).then(response => { console.log([‘request_AddMember’, response.data]) return response.data }).catch(error => { console.log(error.message) }) return { type: “REQUEST_ADDMEMBER”, payload: request } }

this method is not working. I showing error- Request failed with status code 400

Thanks,

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
manojkumawat003commented, Oct 4, 2018

this below code is working for method:‘GET’ correctly. But if i use this for method:‘PATCH’

this shows Error: Request failed with status code 400. Please tell me how to solve this.

export function acceptRequest(EMAIL,TOKEN,members){

const request =   axios({
      method:'GET',
       url:`${FIREBASE}/coordinates.json?orderBy=\"email\"&equalTo=\"${EMAIL}\"`,  
      params:{
        auth:TOKEN,
      },
      data:{
        approvedMembers:members
      }         
}).then(response=>{
    console.log(['approvedMembers',response.data])
    return response.data
}).catch(error=>console.log(error))

return {
    type:'ACCEPTED_REQUEST',
    payload:request
}

}

0reactions
chinesedfancommented, Jan 21, 2020

It is a problem that the server can’t response correctly, instead of an issue of axios. Please look for help in stackoverflow.

A quick solution is that checking final url and request headers and comparing with other ways when you can get the right response. If you confirm that axios sends wrong url/headers, feel free to remind me to reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Retrieving Data | Firebase Realtime Database - Google
The auth request parameter allows access to data protected by Firebase Realtime Database Rules, and is supported by all request types.
Read more >
Post request using axios [React and Firebase Tutorial]
Posting Data to Firebase. A nice guide to get started on react and firebase DON'T CLICK THIS: http://bit.ly/-it-is-a-trapGet In Touch:  ...
Read more >
Firebase OAuth login & data access with axios - Stack Overflow
I am trying to create a sign in using firebase's auth provider functions & then create a user profile in my database using...
Read more >
Firebase REST APIs: Loading & Querying Data Simplified 101
This parameter is specially made for dealing with large datasets without any need of downloading everything. Using the Firebase REST API, you ...
Read more >
Data Provider - Refine Dev
It will take the API URL as a parameter and an optional HTTP client. We will use axios as the default HTTP client....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found