19 lines
470 B
TypeScript
19 lines
470 B
TypeScript
export default defineEventHandler(async (event) => {
|
|
const config = useRuntimeConfig()
|
|
const direction = getRouterParam(event, 'direction')
|
|
|
|
if (direction !== 'forward' && direction !== 'backwards') {
|
|
throw createError({
|
|
statusCode: 400,
|
|
statusMessage: 'Invalid motor direction',
|
|
})
|
|
}
|
|
|
|
return await $fetch(`${config.quibotBaseUrl}/motor/step/${direction}`, {
|
|
method: 'POST',
|
|
query: {
|
|
token: config.quibotToken,
|
|
},
|
|
})
|
|
})
|