2
0
Files
bot/apps/viewer/services/result.ts
2022-03-25 11:16:46 +01:00

27 lines
652 B
TypeScript

import { Log, Result } from 'db'
import { sendRequest } from 'utils'
export const createResult = async (typebotId: string) => {
return sendRequest<Result>({
url: `/api/typebots/${typebotId}/results`,
method: 'POST',
})
}
export const updateResult = async (resultId: string, result: Partial<Result>) =>
sendRequest<Result>({
url: `/api/typebots/t/results/${resultId}`,
method: 'PATCH',
body: result,
})
export const createLog = (
resultId: string,
log: Omit<Log, 'id' | 'createdAt' | 'resultId'>
) =>
sendRequest<Result>({
url: `/api/typebots/t/results/${resultId}/logs`,
method: 'POST',
body: log,
})