fix: access headers outside of `computed`

zio/stable
Daniel Roe 2023-02-12 12:48:52 +01:00
parent b9c2bc5c70
commit 73dc060578
1 changed files with 4 additions and 2 deletions

View File

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