2022-12-10 17:14:48 +08:00
|
|
|
import { useEffect } from 'preact/hooks';
|
|
|
|
|
|
|
|
const { VITE_CLIENT_NAME: CLIENT_NAME } = import.meta.env;
|
|
|
|
|
2022-12-16 13:27:04 +08:00
|
|
|
export default function useTitle(title) {
|
2022-12-10 17:14:48 +08:00
|
|
|
useEffect(() => {
|
2022-12-15 17:11:15 +08:00
|
|
|
document.title = title ? `${title} / ${CLIENT_NAME}` : CLIENT_NAME;
|
2022-12-10 17:14:48 +08:00
|
|
|
}, [title]);
|
2022-12-16 13:27:04 +08:00
|
|
|
}
|