このコミットが含まれているのは:
@@ -0,0 +1,26 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import {
|
||||
CLIENT_SETTINGS_EVENT,
|
||||
getClientBehaviorSettings,
|
||||
} from '@/lib/settings'
|
||||
|
||||
import type { ClientBehaviorSettings } from '@/lib/settings'
|
||||
|
||||
|
||||
export const useClientBehaviourSettings = (): ClientBehaviorSettings => {
|
||||
const [settings, setSettings] =
|
||||
useState<ClientBehaviorSettings> (() => getClientBehaviorSettings ())
|
||||
|
||||
useEffect (() => {
|
||||
const handleClientSettingsChange = () => {
|
||||
setSettings (getClientBehaviorSettings ())
|
||||
}
|
||||
|
||||
window.addEventListener (CLIENT_SETTINGS_EVENT, handleClientSettingsChange)
|
||||
return () =>
|
||||
window.removeEventListener (CLIENT_SETTINGS_EVENT, handleClientSettingsChange)
|
||||
}, [])
|
||||
|
||||
return settings
|
||||
}
|
||||
新しい課題から参照
ユーザをブロックする