-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JS file containing API related library #384
Labels
Comments
I have done some little tests. function w_put(page) {
return fetch("./api/v0/page/" + page.id, {
method: "PUT",
body: JSON.stringify(page)
});
} And users then can use async JS functions: async function generator(){
const random = Math.floor(Math.random() * 1000) + 1;
let randompage = {
id: random,
title: "Page number " + random,
description: "this page has be created using " + w.page.title
};
let res = await w_put(randompage);
if (res.ok) {
alert('The page has been created !');
} else {
alert('error: ' + res.status);
}
} Or use callbacks function generator(){
const random = Math.floor(Math.random() * 1000) + 1;
let randompage = {
id: random,
title: "Page number " + random,
description: "this page has be created using " + w.page.title
};
w_put(randompage).then((res) => {
if (res.ok) {
alert('The page has been created !');
} else {
alert('error: ' + res.status);
}
});
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A library that allow editors to interact easily with W's API.
It would be linked in every W pages.
Should it use versioning like the API itselft ?
The text was updated successfully, but these errors were encountered: