mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-28 14:16:41 +07:00
removed player reducer, migrated to CRA 5
This commit is contained in:
parent
88f8fe21f7
commit
558e8f8a4f
211 changed files with 7131 additions and 10318 deletions
16
src/hooks/metadata/useYoutubeMetadata.ts
Normal file
16
src/hooks/metadata/useYoutubeMetadata.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { useMetadataProvider } from '~/utils/providers/MetadataProvider';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export const useYoutubeMetadata = (id: string) => {
|
||||
const { queue, enqueue, metadata, pending } = useMetadataProvider();
|
||||
|
||||
useEffect(() => {
|
||||
if (queue.includes(id) || pending.includes(id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
enqueue(id);
|
||||
}, [id]);
|
||||
|
||||
return metadata[id];
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue