Skip to content

Commit

Permalink
fix get request
Browse files Browse the repository at this point in the history
  • Loading branch information
korolr committed May 26, 2019
1 parent f6fd9a2 commit ee6dafb
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/components/Comments.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</div>
{/each}
{:else}
<h2>Нет коментариев</h2>
<h2>Not comments</h2>
{/if}

<h2>Write comment</h2>
Expand Down
8 changes: 0 additions & 8 deletions src/components/PageView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@
font-size: 18px;
margin-left: 6px;
}
.post {
font-size: 26px;
}
.rev dt {
font-size: 18px;
margin-left: 6px;
}
</style>

<h1 class="row row-cen">{post.title.rendered}</h1>
Expand Down
6 changes: 4 additions & 2 deletions src/containers/Author.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
export let router = {};
let posts = [];
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
onMount(async () => {
let id;
await sleep(300);
await Promise.all(
$author.map(data => {
if (data.name === router.params.name) {
Expand Down
6 changes: 4 additions & 2 deletions src/containers/Category.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
let posts = [];
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
onMount(async () => {
let id;
await sleep(300);
await Promise.all(
$category.map(data => {
if (data.name === router.params.name) {
Expand All @@ -27,7 +30,6 @@
);
posts = await res.json();
document.title = router.params.name;
console.log(router.params.name);
});
</script>

Expand Down
2 changes: 1 addition & 1 deletion src/containers/Page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
);
data = await resData.json();
const resComments = await fetch(
process.env.SITE + "/wp-json/wp/v2/comments?post" + router.params.id
process.env.SITE + "/wp-json/wp/v2/comments?post=" + router.params.id
);
comments = await resComments.json();
Expand Down

0 comments on commit ee6dafb

Please sign in to comment.