23 lines
424 B
JavaScript
23 lines
424 B
JavaScript
import { defineStore } from 'pinia'
|
|
|
|
export const useNetworkStore = defineStore('network', {
|
|
state: () => ({
|
|
isOnline: navigator.onLine,
|
|
isLoading: false
|
|
}),
|
|
actions: {
|
|
setOnline(status) {
|
|
this.isOnline = status
|
|
if (status) {
|
|
this.isLoading = false
|
|
}
|
|
},
|
|
startLoading() {
|
|
this.isLoading = true
|
|
},
|
|
stopLoading() {
|
|
this.isLoading = false
|
|
}
|
|
}
|
|
})
|