File size: 558 Bytes
a85305f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"use client"

import { ReactNode, useTransition } from "react"

import { Video, VideoStatus } from "@/app/types"
import { setVideoStatus } from "@/server"

export function ChangeStatusButton({ video, children, status }: { video: Video; children: ReactNode; status: VideoStatus }) {
  let [isPending, startTransition] = useTransition()
 
 return (
  <div
    className="hover:underline cursor-pointer"
    onClick={() => {
      startTransition(async () => {
        await setVideoStatus(video.ownerId, video.id, status)
      })
    }}>{children}</div>
  )
}