1
Fork 0

Allow args to be passed to reverser

This commit is contained in:
Jake Howard 2016-01-20 18:52:04 +00:00
parent 87f3fb9882
commit bdfad83ad7

View file

@ -1,11 +1,19 @@
export default function Reverser(ident) { export default function Reverser(ident, args) {
let body = {};
if (ident) {
body.ident = ident;
}
if (args) {
body.args = args;
}
body = JSON.stringify(body);
return fetch('/reverse/', { return fetch('/reverse/', {
method: 'post', method: 'post',
headers: { headers: {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify({ident}) body
}).then(function (response) { }).then(function (response) {
if (response.status === 302) { if (response.status === 302) {
return response; return response;