Skip to content

Commit

Permalink
fix(forms): use github instead of local to access yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerzl committed Sep 30, 2024
1 parent f072eb4 commit 7b9f0cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default defineNuxtConfig({
storage: {
github: {
driver: 'github',
branch: 'next',
branch: 'prod',
dir: '/data',
repo: 'computerization/enspire',
},
Expand Down
8 changes: 1 addition & 7 deletions server/api/forms/open.get.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import dayjs from 'dayjs'
import { createStorage } from 'unstorage'
import fsLiteDriver from 'unstorage/drivers/fs-lite'
import { parse } from 'yaml'
import type { Form, Forms } from '~/types/data/forms'

const storage = createStorage({
driver: fsLiteDriver({ base: './data' }),
})

export default eventHandler(async (event) => {
const { auth } = event.context

Expand All @@ -16,7 +10,7 @@ export default eventHandler(async (event) => {
return
}

const yaml = await storage.getItem('forms:forms.yaml') as string
const yaml = await useStorage('github').getItem('forms:forms.yaml') as string

if (!yaml) {
setResponseStatus(event, 404)
Expand Down

0 comments on commit 7b9f0cc

Please sign in to comment.