Skip to content

Commit 7b9f0cc

Browse files
committed
fix(forms): use github instead of local to access yaml
1 parent f072eb4 commit 7b9f0cc

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default defineNuxtConfig({
1414
storage: {
1515
github: {
1616
driver: 'github',
17-
branch: 'next',
17+
branch: 'prod',
1818
dir: '/data',
1919
repo: 'computerization/enspire',
2020
},

server/api/forms/open.get.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
import dayjs from 'dayjs'
2-
import { createStorage } from 'unstorage'
3-
import fsLiteDriver from 'unstorage/drivers/fs-lite'
42
import { parse } from 'yaml'
53
import type { Form, Forms } from '~/types/data/forms'
64

7-
const storage = createStorage({
8-
driver: fsLiteDriver({ base: './data' }),
9-
})
10-
115
export default eventHandler(async (event) => {
126
const { auth } = event.context
137

@@ -16,7 +10,7 @@ export default eventHandler(async (event) => {
1610
return
1711
}
1812

19-
const yaml = await storage.getItem('forms:forms.yaml') as string
13+
const yaml = await useStorage('github').getItem('forms:forms.yaml') as string
2014

2115
if (!yaml) {
2216
setResponseStatus(event, 404)

0 commit comments

Comments
 (0)