feat: build Onyx SSR shell and plan hero with mock data
This commit is contained in:
1 parent
84c20992f9
commit
2db494fb10
34 files changed
+3197
-2
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import { SCENARIOS } from '../../shared/types'
|
||||
import type { Scenario, ScenarioDefinition } from '../../shared/types'
|
||||
import { mockScenario } from '../utils/mock-data'
|
||||
|
||||
let version = mockScenario.version
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const body = await readBody<ScenarioDefinition>(event)
|
||||
const scenario = body?.scenario
|
||||
if (!scenario || !SCENARIOS.includes(scenario as Scenario)) {
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: 'Invalid scenario. Expected base | sunny-saturday-market | rainy-saturday | weekday-event.',
|
||||
})
|
||||
}
|
||||
version += 1
|
||||
return {
|
||||
version,
|
||||
scenario: body,
|
||||
at: new Date().toISOString(),
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user