mirror of
https://github.com/penxio/penx.git
synced 2026-04-19 03:03:06 -04:00
24 lines
483 B
TypeScript
24 lines
483 B
TypeScript
'use client'
|
|
|
|
import { useEffect } from 'react'
|
|
import { useRouter } from '@/lib/i18n'
|
|
import { appEmitter } from '@penx/emitter'
|
|
|
|
export function WatchAppEvent() {
|
|
const { push } = useRouter()
|
|
useEffect(() => {
|
|
appEmitter.on('ON_LOGOUT_SUCCESS', () => {
|
|
push('/')
|
|
})
|
|
|
|
appEmitter.on('ROUTE_TO_SETTINGS', () => {
|
|
location.href = '/~/settings'
|
|
})
|
|
|
|
appEmitter.on('ROUTE_TO_DESIGN', () => {
|
|
push('/~/design')
|
|
})
|
|
}, [push])
|
|
return null
|
|
}
|