mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
755 B
25 lines
755 B
import { ref } from 'vue' |
|
import type { Getters, State } from './types' |
|
|
|
export function useGlobalGetters(state: State): Getters { |
|
/** Verify that a user is signed in by checking if token exists and is not expired */ |
|
const signedIn: Getters['signedIn'] = computed( |
|
() => |
|
!!( |
|
!!state.token && |
|
state.token.value !== '' && |
|
state.jwtPayload.value && |
|
state.jwtPayload.value.exp && |
|
state.jwtPayload.value.exp > state.timestamp.value / 1000 |
|
), |
|
) |
|
|
|
/** global loading state */ |
|
const loading = ref(false) |
|
const isLoading = computed({ |
|
get: () => state.runningRequests.count.value > 0 || loading.value, |
|
set: (_loading) => (loading.value = _loading), |
|
}) |
|
|
|
return { signedIn, isLoading } |
|
}
|
|
|