Skip to content

Commit

Permalink
✨ Pre-render home page
Browse files Browse the repository at this point in the history
  • Loading branch information
homostellaris committed Mar 21, 2024
1 parent 70167c8 commit fa2aecc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 45 deletions.
3 changes: 1 addition & 2 deletions src/routes/+page.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
// TODO: Migrate to standalone endpoint and re-enable
export const prerender = false
export const prerender = true
34 changes: 0 additions & 34 deletions src/routes/+page.server.js

This file was deleted.

30 changes: 21 additions & 9 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script>
import {goto} from '$app/navigation'
import Next from '$lib/Next.svelte'
import {theme} from '$lib/theme.store'
import {Progress} from 'spaper'
Expand All @@ -20,16 +21,27 @@
<h1>The fastest way to find out when your friends are free</h1>
<p>Let's start with your name</p>

<!-- TODO: Add enhancement to get loading state again -->
<!-- use:enhance={() => {
loading = true
return async ({update}) => {
loading = false
update()
}
}} -->
<!-- svelte-ignore missing-declaration -->
<form method="post">
<form
on:submit={async e => {
loading = true

try {
const formData = new FormData(e.target)
const name = formData.get('name')

const response = await fetch('/create', {
method: 'POST',
body: formData,
})

const socialId = await response.text()
await goto(`/${socialId}/you?name=${name}`)
} finally {
loading = false
}
}}
>
<input
id="name"
class="margin-bottom-small"
Expand Down

0 comments on commit fa2aecc

Please sign in to comment.