export const {types, actions, reducers} = createResource({
name: 'user',
url: 'https://foo.com/users/:id',
headers: {
'X-Custom-Header': 'foobar'
}
});
import {defaultHeaders} from 'redux-rest-resource';
const jwt = 'xvDjirE9MCIi800xMxi4EKeTm8e9FUBR';
Object.assign(defaultHeaders, {Authorization: `Bearer ${jwt}`});
export const {types, actions, reducers} = createResource({
name: 'user',
url: 'https://foo.com/users/:id',
actions: {
update: {
headers: {
'X-Custom-Header': 'foobar'
}
}
}
});
actions.updateUser({firstName: 'Olivier'}, {headers: {Authorization: `Bearer ${jwt}`}});