"use client"
import { useSetAtom } from "jotai"
import { useEffect } from "react"
import { scopesAtom } from "@/lib/stores/scopes"
import type { Admin } from "@/models/admin"

export default function SetScopes(props: {
  admin: Admin & { scopes: string[] }
}) {
  const setScopes = useSetAtom(scopesAtom)

  useEffect(() => {
    setScopes(props.admin.scopes)
  }, [props.admin.scopes, setScopes])

  return null
}
