Skip to content

Commit

Permalink
Merge pull request #8 from fumeapp/redirect
Browse files Browse the repository at this point in the history
✨ proper redirect and date fix
  • Loading branch information
acidjazz authored Aug 24, 2024
2 parents d18cbce + 0ca3292 commit 1d6e98b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/components/shot/ShotForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const create = async () => useApi()
.setForm(form?.value)
.api<MetapiResponse<Shot>>(
route.params.user ? `/api/user/${route.params.user}/shot` : '/api/shot',
{ method: 'POST', body: { ...state, date: toUtc(state.date) } },
{ method: 'POST', body: { ...state, date: new Date(`${state.date}T00:00:00`).toISOString() } },
)
.then(() => emit('created'))
</script>
Expand Down
6 changes: 4 additions & 2 deletions app/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<script setup lang="ts">
definePageMeta({ layout: 'bare' })
const { user } = useUserSession()
const { loggedIn } = useUserSession()
if (loggedIn.value) await navigateTo('/home')
</script>

<template>
<div class="flex flex-col w-screen h-screen items-center justify-center">
<logo-bio class="w-64 h-64" />
<logo-text class="text-5xl mb-8" />
<layout-login v-if="!user" />
<layout-login v-if="!loggedIn" />
<u-button v-else class="w-28" icon="i-mdi-home" label="Home" to="/home" size="lg" color="gray" />
</div>
</template>
Expand Down
2 changes: 0 additions & 2 deletions app/utils/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import type { CookieOptions } from '#app'

export type HeaderIconLink = HeaderLink & { icon: string }

export const toUtc = (date: string) => new Date((new Date(date)).getTime() + (new Date(date)).getTimezoneOffset() * 60000)

export const links: HeaderIconLink[] = [
{
label: 'Home',
Expand Down

0 comments on commit 1d6e98b

Please sign in to comment.