feat(results): ✨ Add logs in results
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { Result } from 'db'
|
||||
import { Log, Result } from 'db'
|
||||
import { VariableWithValue } from 'models'
|
||||
import { sendRequest } from 'utils'
|
||||
|
||||
@ -7,19 +7,25 @@ export const createResult = async (
|
||||
prefilledVariables: VariableWithValue[]
|
||||
) => {
|
||||
return sendRequest<Result>({
|
||||
url: `/api/results`,
|
||||
url: `/api/typebots/${typebotId}/results`,
|
||||
method: 'POST',
|
||||
body: { typebotId, prefilledVariables },
|
||||
body: { prefilledVariables },
|
||||
})
|
||||
}
|
||||
|
||||
export const updateResult = async (
|
||||
resultId: string,
|
||||
result: Partial<Result>
|
||||
) => {
|
||||
return sendRequest<Result>({
|
||||
url: `/api/results/${resultId}`,
|
||||
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,
|
||||
})
|
||||
|
Reference in New Issue
Block a user