mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-13 11:23:50 +00:00
feat: automatic refetch css override (#1588)
* feat: send refect on css change * feat: revamp ViewLoader --------- Co-authored-by: alex-Arc <omnivox@LAPTOP-RC5SNBVV.localdomain>
This commit is contained in:
committed by
GitHub
parent
fd39cab845
commit
871a6b46c8
@@ -0,0 +1,18 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { MILLIS_PER_HOUR } from 'ontime-utils';
|
||||
|
||||
import { getCSSContents } from '../api/assets';
|
||||
import { CSS_OVERRIDE } from '../api/constants';
|
||||
|
||||
export default function useCssOverride(enabled: boolean) {
|
||||
const { data, status } = useQuery({
|
||||
queryKey: CSS_OVERRIDE,
|
||||
queryFn: ({ signal }) => getCSSContents({ signal }),
|
||||
staleTime: MILLIS_PER_HOUR,
|
||||
enabled
|
||||
});
|
||||
|
||||
return {
|
||||
data: data ?? '', status
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user