fix: access headers outside of computed

This commit is contained in:
Daniel Roe 2023-02-12 12:48:52 +01:00
parent b9c2bc5c70
commit 73dc060578

View file

@ -27,9 +27,11 @@ export function emojisArrayToObject(emojis: mastodon.v1.CustomEmoji[]) {
export function noop() {} export function noop() {}
export const useIsMac = () => computed(() => export const useIsMac = () => {
useRequestHeaders(['user-agent'])['user-agent']?.includes('Macintosh') const headers = useRequestHeaders(['user-agent'])
return computed(() => headers['user-agent']?.includes('Macintosh')
?? navigator?.platform?.includes('Mac') ?? false) ?? navigator?.platform?.includes('Mac') ?? false)
}
export const isEmptyObject = (object: Object) => Object.keys(object).length === 0 export const isEmptyObject = (object: Object) => Object.keys(object).length === 0