Closed jacksonp2008 closed 7 years ago
Auth can be passed in by the config
prop. See the example below...
<Request
instance={axios.create({})} /* custom instance of axios - optional */
method="" /* get, delete, head, post, put and patch - required */
url="" /* url endpoint to be requested - required */
data={} /* post data - optional */
config={auth: {
username: 'janedoe',
password: 's00pers3cret'
}} /* axios config - optional */
debounce={200} /* minimum time between requests events - optional */
debounceImmediate={true} /* make the request on the beginning or trailing end of debounce - optional */
isReady={true} /* can make the axios request - optional */
onSuccess={(response)=>{}} /* called on success of axios request - optional */
onLoading={()=>{}} /* called on start of axios request - optional */
onError=(error)=>{} /* called on error of axios request - optional */
/>
Is there documentation anywhere? I am new to React, trying to add your component in, but have little knowledge of axios.
axios supports basic auth it appears: https://www.npmjs.com/package/axios
//
auth
indicates that HTTP Basic auth should be used, and supplies credentials. // This will set anAuthorization
header, overwriting any existing //Authorization
custom headers you have set usingheaders
. auth: { username: 'janedoe', password: 's00pers3cret' },