mirror of
git://f0xx.org/android_cast
synced 2026-07-29 06:18:42 +03:00
wg start
This commit is contained in:
@@ -31,14 +31,30 @@
|
||||
fetch(base + '/api/build_trigger.php', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
credentials: 'same-origin',
|
||||
body: JSON.stringify(payload)
|
||||
}).then(function (r) { return r.json(); }).then(function (j) {
|
||||
}).then(function (r) {
|
||||
return r.text().then(function (text) {
|
||||
var j = null;
|
||||
try {
|
||||
j = JSON.parse(text);
|
||||
} catch (e) {
|
||||
throw new Error(r.status + ': ' + (text.slice(0, 120) || r.statusText));
|
||||
}
|
||||
if (!r.ok) {
|
||||
throw new Error((j && j.error) || ('HTTP ' + r.status));
|
||||
}
|
||||
return j;
|
||||
});
|
||||
}).then(function (j) {
|
||||
if (j.ok && j.build && j.build.id) {
|
||||
window.location.href = base + '/?view=build&id=' + j.build.id;
|
||||
} else {
|
||||
status.textContent = j.error || 'Failed';
|
||||
}
|
||||
}).catch(function () { status.textContent = 'Network error'; });
|
||||
}).catch(function (err) {
|
||||
status.textContent = err && err.message ? err.message : 'Network error';
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user