VideoChain-UI / src /app /page.tsx
jbilcke-hf's picture
jbilcke-hf HF staff
fix bad bug
829f152
raw
history blame
618 Bytes
"use client"
import { useEffect, useState } from "react"
import { v4 as uuidv4 } from "uuid"
const key = "VideoChain-UI-Owner-ID"
export default function Index() {
const [uuid, setUuid] = useState<string>()
useEffect(() => {
if (uuid) {
window.location.href = `/studio/${uuid}`
} else {
const existingUuid = `${localStorage.getItem(key) || ""}`
if (existingUuid?.length > 10) {
setUuid(existingUuid)
} else {
const newUuid = uuidv4()
setUuid(newUuid)
localStorage.setItem(key, newUuid)
}
}
}, [uuid])
return <div>Loading..</div>
}