Skip to content

Commit

Permalink
🚧 not good
Browse files Browse the repository at this point in the history
  • Loading branch information
acidjazz committed Sep 14, 2024
1 parent 2ae24c7 commit cacfc99
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
5 changes: 4 additions & 1 deletion app/components/cycle/CycleForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ const state = reactive<UserCycle>({
const create = async () => useApi()
.setForm(form?.value)
.api<MetapiResponse<Pen>>(`/api/user/${route.params.user}/cycle`, { method: 'POST', body: { ...state, date: new Date(`${state.date}T00:00:)0`).toISOString() } })
.api<MetapiResponse<Pen>>(`/api/user/${route.params.user}/cycle`, {
method: 'POST',
body: { ...state, date: new Date(`${state.date}T00:00:00`).toISOString() },
})
.then(() => emit('created'))
</script>

Expand Down
16 changes: 9 additions & 7 deletions app/components/header/HeaderMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ const links = [
</u-header>
<div class="bg-gray-100 dark:bg-gray-950">
<div class="py-2 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto">
<div v-if="crumbs.length" class="flex items-center justify-between space-x-2 py-2">
<u-breadcrumb :links="crumbs" />
<u-button-group v-if="actions && actions[0]" :size="actions[0].size">
<u-button v-for="action in actions" :key="action.label" v-bind="action" @click="action.click" />
</u-button-group>
</div>
<div v-else class="h-10" />
<client-only>
<div v-if="crumbs.length" class="flex items-center justify-between space-x-2 py-2">
<u-breadcrumb :links="crumbs" />
<u-button-group v-if="actions && actions[0]" :size="actions[0].size">
<u-button v-for="action in actions" :key="action.label" v-bind="action" @click="action.click" />
</u-button-group>
</div>
<div v-else class="h-10" />
</client-only>
</div>
</div>
</template>
Expand Down
2 changes: 2 additions & 0 deletions server/controllers/cycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { cartridgeContents } from '~/utils/shared'
import { cycle as policies } from '../policies/cycle'

const create = async ({ user }: { user: User }, event: H3Event) => {
console.log('cycle.create')
const { user: authed } = await requireUserSession(event)
authorize(policies.create, { authed })
const schema = z.object({
Expand All @@ -21,6 +22,7 @@ const create = async ({ user }: { user: User }, event: H3Event) => {
payload.cycles = []
payload.cycles?.push(parsed.data)

console.log('we got right before metapi().success')
return metapi().success('cycle created', await usePrisma(event).user.update({
data: {
payload: JSON.stringify(payload),
Expand Down
1 change: 1 addition & 0 deletions server/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function modelBoundHandler<T extends Record<string, any>>(
handler: (models: T, event: H3Event) => Promise<any>,
) {
return defineEventHandler(async (event: H3Event) => {
console.log('modelNames', modelNames)
const boundModels = await lookupModels<T>(modelNames, event)
return handler(boundModels, event)
})
Expand Down

0 comments on commit cacfc99

Please sign in to comment.