This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
2022-01-01 12:43:24 +00:00
|
|
|
import {ref} from 'vue'
|
2022-04-11 20:08:28 +00:00
|
|
|
import {useOnline as useNetworkOnline} from '@vueuse/core'
|
|
|
|
import type {ConfigurableWindow} from '@vueuse/core'
|
2022-01-01 12:43:24 +00:00
|
|
|
|
|
|
|
export function useOnline(options?: ConfigurableWindow) {
|
2023-01-05 13:33:37 +00:00
|
|
|
const isOnline = useNetworkOnline(options)
|
2022-05-22 14:20:06 +00:00
|
|
|
const fakeOnlineState = Boolean(import.meta.env.VITE_IS_ONLINE)
|
2023-01-05 13:33:37 +00:00
|
|
|
if (isOnline.value === false && fakeOnlineState) {
|
2022-01-01 12:43:24 +00:00
|
|
|
console.log('Setting fake online state', fakeOnlineState)
|
2023-01-05 13:33:37 +00:00
|
|
|
return ref(true)
|
2022-01-01 12:43:24 +00:00
|
|
|
}
|
2023-01-05 13:33:37 +00:00
|
|
|
return isOnline
|
2022-01-01 12:43:24 +00:00
|
|
|
}
|