-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* store user info in JWT. yeah, yeah, i know * use prefetching promise if available, reload on query change * inject credentials in server-side fetch * start updating realworld example * always supply a body when posting * swap tabs * simplify setup * simplify settings page * replace/pushState on goto * handle redirects * update lockfile * add preloading indicator * fix prettier config * remove double layout * update manifest/logo * remove unwanted segment * fix settings page * fix following logic * various * only insist on a body for GET requests * only attempt 304s for get requests * allow empty responses for non-GET requests * allow forms to override method with ?_method=delete etc * fix comment submission/deleting, including progressive enhancement * some changes i apparently made before christmas * update imports * minor fixes * fix imports
- Loading branch information
Rich Harris
authored
Mar 25, 2021
1 parent
531cf0c
commit 52f5a22
Showing
63 changed files
with
1,037 additions
and
637 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"paths": { | ||
"$app/*": [".svelte/dev/runtime/app/*", ".svelte/build/runtime/app/*"], | ||
"$lib/*": ["src/lib/*"] | ||
} | ||
}, | ||
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
"svelte": "^3.35.0" | ||
}, | ||
"dependencies": { | ||
"cookie": "^0.4.1", | ||
"node-fetch": "^2.6.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
examples/realworld.svelte.dev/src/lib/ArticleList/ListPagination.svelte
This file was deleted.
Oops, something went wrong.
57 changes: 10 additions & 47 deletions
57
examples/realworld.svelte.dev/src/lib/ArticleList/index.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,16 @@ | ||
<script> | ||
import { session, page } from '$app/stores'; | ||
import * as api from '$lib/api.js'; | ||
import { session } from '$app/stores'; | ||
import ArticlePreview from './ArticlePreview.svelte'; | ||
import ListPagination from './ListPagination.svelte'; | ||
export let tab, username = false; | ||
export let favorites = false; | ||
export let tag; | ||
export let p; | ||
let query; | ||
let articles; | ||
let articlesCount; | ||
$: { | ||
const endpoint = tab === 'feed' ? 'articles/feed' : 'articles'; | ||
const page_size = tab === 'feed' ? 5 : 10; | ||
let params = `limit=${page_size}&offset=${(p - 1) * page_size}`; | ||
if (tab === 'tag') params += `&tag=${tag}`; | ||
if (tab === 'profile') params += `&${favorites ? 'favorited' : 'author'}=${encodeURIComponent(username)}`; | ||
query = `${endpoint}?${params}`; | ||
} | ||
$: query && getData(); | ||
async function getData() { | ||
articles = null; | ||
// TODO do we need some error handling here? | ||
({ articles, articlesCount } = await api.get(query, $session.user && $session.user.token)); | ||
} | ||
export let articles; | ||
</script> | ||
|
||
{#if articles} | ||
{#if articles.length === 0} | ||
<div class="article-preview"> | ||
No articles are here... yet. | ||
</div> | ||
{:else} | ||
<div> | ||
{#each articles as article (article.slug)} | ||
<ArticlePreview {article} user={$session.user}/> | ||
{/each} | ||
|
||
<ListPagination {articlesCount} page={parseInt($page.params.user, 10)} /> | ||
</div> | ||
{/if} | ||
{#if articles.length === 0} | ||
<div class="article-preview">No articles are here... yet.</div> | ||
{:else} | ||
<div class="article-preview">Loading...</div> | ||
{/if} | ||
<div> | ||
{#each articles as article (article.slug)} | ||
<ArticlePreview {article} user={$session.user} /> | ||
{/each} | ||
</div> | ||
{/if} |
This file was deleted.
Oops, something went wrong.
54 changes: 0 additions & 54 deletions
54
examples/realworld.svelte.dev/src/lib/MainView/index.svelte
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.