2
0
Files
bot/apps/viewer/services/result.ts
2022-02-17 16:08:01 +01:00

26 lines
546 B
TypeScript

import { Result } from 'db'
import { VariableWithValue } from 'models'
import { sendRequest } from 'utils'
export const createResult = async (
typebotId: string,
prefilledVariables: VariableWithValue[]
) => {
return sendRequest<Result>({
url: `/api/results`,
method: 'POST',
body: { typebotId, prefilledVariables },
})
}
export const updateResult = async (
resultId: string,
result: Partial<Result>
) => {
return sendRequest<Result>({
url: `/api/results/${resultId}`,
method: 'PATCH',
body: result,
})
}