Compare commits

...

1 Commits

Author SHA1 Message Date
Laurent Drogou
488fe1772c feat: exercice 1 partiel 2022-03-25 23:06:07 +01:00
2 changed files with 3206 additions and 2 deletions

3190
package-lock.json generated

File diff suppressed because it is too large Load Diff

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() { export function get() {
axios.get("http://localhost:3000/orders/1")
.then(({ data }) => {
setText(JSON.stringify(data));
});
} }
export function getCatch() { export function getCatch() {
axios.get("http://localhost:3000/orders/123")
.then(({ data }) => {
setText(JSON.stringify(data));
})
.catch(err => setText(err));
} }
export function chain() { 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() { export function chainCatch() {