feat: exercice 1 partiel

This commit is contained in:
Laurent Drogou
2022-03-25 23:06:07 +01:00
parent b1c54d4d98
commit 488fe1772c
2 changed files with 3206 additions and 2 deletions

View File

@@ -1,12 +1,28 @@
import setText, {appendText, showWaiting, hideWaiting} from "./results.mjs";
import setText, { appendText, showWaiting, hideWaiting } from "./results.mjs";
export function get() {
axios.get("http://localhost:3000/orders/1")
.then(({ data }) => {
setText(JSON.stringify(data));
});
}
export function getCatch() {
axios.get("http://localhost:3000/orders/123")
.then(({ data }) => {
setText(JSON.stringify(data));
})
.catch(err => setText(err));
}
export function chain() {
axios.get("http://localhost:3000/orders/1")
.then(({ data }) => {
return axios.get(`http://localhost:3000/addresses/${data.shippingAddress}`);
})
.then(({data}) => {
setText(`City: ${data.city}`);
});
}
export function chainCatch() {