Spaces:
Paused
Paused
File size: 1,047 Bytes
43dd1ac |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
"use server"
import { VideoTask, VideoTaskRequest } from "@/app/types"
import { get, post } from "./base"
// note: for security purposes we do not directly expose the VideoChain API:
// all calls are protected with a token, that way it the VideooChain API can stay
// lightweight, security and quotas are handled outside
// attention: this return *ALL* pending tasks, including those of other users
export const getPendingTasks = async () => {
const tasks = await get<VideoTask[]>("", [])
return tasks
}
// return all tasks of a owner
export const getTasks = async (ownerId: string) => {
const tasks = await get<VideoTask[]>(`owner/${ownerId}`, [])
return tasks
}
export const getTask = async (ownerAndVideoId: string) => {
const task = await get<VideoTask>(ownerAndVideoId, null as unknown as VideoTask)
return task
}
export const submitNewTask = async (taskRequest: VideoTaskRequest) => {
const task = await post<VideoTaskRequest, VideoTask>(
"",
taskRequest,
null as unknown as VideoTask
)
return task
} |