mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-27 10:32:58 +02:00
21 lines
610 B
TypeScript
21 lines
610 B
TypeScript
import useAsyncEffect, { AsyncEffectEvent } from '@joplin/lib/hooks/useAsyncEffect';
|
|
import { ProfileConfig } from '@joplin/lib/services/profileConfig/types';
|
|
import { useState } from 'react';
|
|
import { loadProfileConfig } from '../../services/profiles';
|
|
|
|
export default (timestamp = 0) => {
|
|
const [profileConfig, setProfileConfig] = useState<ProfileConfig>(null);
|
|
|
|
useAsyncEffect(async (event: AsyncEffectEvent) => {
|
|
const load = async () => {
|
|
const r = await loadProfileConfig();
|
|
if (event.cancelled) return;
|
|
setProfileConfig(r);
|
|
};
|
|
|
|
void load();
|
|
}, [timestamp]);
|
|
|
|
return profileConfig;
|
|
};
|