Skip to content

Commit 271549f

Browse files
committed
Formatted
1 parent 54e5f5e commit 271549f

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

src/routes/api/entries.json.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ export const get: RequestHandler = async req => {
1010
const showVisible = req.url.searchParams.get('visible') !== 'false'
1111
const showUnlisted = req.url.searchParams.get('unlisted') === 'true'
1212
const showHidden = req.url.searchParams.get('hidden') === 'true'
13-
const tags = req.url.searchParams.get('tags')?.split(',')?.map(tag => tag.trim())?.filter(tag => tag.length > 0)
13+
const tags = req.url.searchParams
14+
.get('tags')
15+
?.split(',')
16+
?.map(tag => tag.trim())
17+
?.filter(tag => tag.length > 0)
1418
const query = req.url.searchParams.get('query')
1519

1620
const user = req.locals.user ? await fetchUser({ id: req.locals.user.id }) : null

src/routes/edit/[slug].svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@
4747
async function submitEntry() {
4848
// make a put request to /api/entry/<id>.json
4949
// if successful, redirect to /entry/<slug>
50-
entryTags = entryTags.split(',').map(tag => tag.trim()).filter(tag => tag.length > 0)
50+
entryTags = entryTags
51+
.split(',')
52+
.map(tag => tag.trim())
53+
.filter(tag => tag.length > 0)
5154
const response: Entry | { error: string } = await fetch(`/api/entry/${entry.id}.json`, {
5255
method: 'PUT',
5356
headers: {

src/routes/edit/index.svelte

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,12 @@
4242
pageTitle = entryTitle.length ? `New entry "${entryTitle}"` : 'New entry'
4343
}
4444
45-
async function submitEntry() {
45+
const submitEntry = async () => {
4646
// make a post/put request to /api/entries.json
4747
// if successful, redirect to /entry/<slug>
4848
entryTags = entryTags.split(',')
49-
if (entryTags.length == 1 && entryTags[0] == '') {
50-
entryTags = []
51-
}
49+
if (entryTags.length == 1 && entryTags[0] == '') entryTags = []
50+
5251
const response: Entry | { error: string } = await fetch('/api/entries.json', {
5352
method: 'POST',
5453
headers: {

src/routes/index.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,22 @@
3535
3636
let fetchIndex = 0
3737
38-
async function updateEntries() {
38+
const updateEntries = async () => {
3939
fetchIndex += 1
4040
let thisFetchIndex = fetchIndex
4141
4242
let tags: string
4343
let query: string
44+
4445
if (!searchValue) {
4546
query = undefined
4647
} else {
4748
let all = searchValue.split(' ')
4849
query = all.filter(word => !word.startsWith('tags:')).join(' ')
50+
4951
if (searchValue.includes('tags:')) {
5052
let tags_raw = all.filter(word => word.startsWith('tags:'))[0]
5153
tags = tags_raw.slice(5).replaceAll('_', '%20')
52-
console.log(query)
5354
}
5455
}
5556
@@ -70,6 +71,7 @@
7071
7172
$: {
7273
;[showVisible, showUnlisted, showHidden]
74+
7375
if (browser) {
7476
updateEntries()
7577
}

src/routes/login.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export const get: RequestHandler = async req => {
5252
}).then(res => res.json())
5353

5454
if (!discordUserData.id) {
55-
console.log(discordUserData)
5655
throw new Error('Failed to get user data from Discord')
5756
}
5857

@@ -64,6 +63,7 @@ export const get: RequestHandler = async req => {
6463
})
6564

6665
let sessionId: string
66+
6767
if (existingRepldexUser) {
6868
// the user has a repldex account, create a new session for them
6969
sessionId = await createSession({

0 commit comments

Comments
 (0)