fix (tutorial): use different random image service

pull/6154/head
Michael Rienstra 5 years ago
parent bcf2313a34
commit 04ed93af2f

@ -4,7 +4,7 @@
let photos = [];
onMount(async () => {
const res = await fetch(`https://jsonplaceholder.typicode.com/photos?_limit=20`);
const res = await fetch(`https://picsum.photos/v2/list?limit=20`);
photos = await res.json();
});
</script>
@ -28,8 +28,8 @@
<div class="photos">
{#each photos as photo}
<figure>
<img src={photo.thumbnailUrl} alt={photo.title}>
<figcaption>{photo.title}</figcaption>
<img src={photo.download_url.replace(/\/\d+\/\d+$/, '/128/128')} alt={photo.author}>
<figcaption>{photo.author}</figcaption>
</figure>
{:else}
<!-- this block renders when photos.length === 0 -->

@ -21,8 +21,8 @@
<div class="photos">
{#each photos as photo}
<figure>
<img src={photo.thumbnailUrl} alt={photo.title}>
<figcaption>{photo.title}</figcaption>
<img src={photo.download_url.replace(/\/\d+\/\d+$/, '/128/128')} alt={photo.author}>
<figcaption>{photo.author}</figcaption>
</figure>
{:else}
<!-- this block renders when photos.length === 0 -->

@ -4,7 +4,7 @@
let photos = [];
onMount(async () => {
const res = await fetch(`https://jsonplaceholder.typicode.com/photos?_limit=20`);
const res = await fetch(`https://picsum.photos/v2/list?limit=20`);
photos = await res.json();
});
</script>
@ -28,8 +28,8 @@
<div class="photos">
{#each photos as photo}
<figure>
<img src={photo.thumbnailUrl} alt={photo.title}>
<figcaption>{photo.title}</figcaption>
<img src={photo.download_url.replace(/\/\d+\/\d+$/, '/128/128')} alt={photo.author}>
<figcaption>{photo.author}</figcaption>
</figure>
{:else}
<!-- this block renders when photos.length === 0 -->

@ -15,7 +15,7 @@ We'll add an `onMount` handler that loads some data over the network:
let photos = [];
onMount(async () => {
const res = await fetch(`https://jsonplaceholder.typicode.com/photos?_limit=20`);
const res = await fetch(`https://picsum.photos/v2/list?limit=20`);
photos = await res.json();
});
</script>

Loading…
Cancel
Save