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.
68 lines
1.6 KiB
68 lines
1.6 KiB
2 years ago
|
import type { ComputedRef, Ref, ToRefs } from 'vue'
|
||
|
import type { WritableComputedRef } from '@vue/reactivity'
|
||
|
import type { JwtPayload } from 'jwt-decode'
|
||
|
import type { User } from '~/lib'
|
||
2 years ago
|
import type { useCounter } from '#imports'
|
||
2 years ago
|
|
||
2 years ago
|
export interface FeedbackForm {
|
||
|
url: string
|
||
|
createdAt: string
|
||
|
isHidden: boolean
|
||
|
lastFormPollDate?: string
|
||
|
}
|
||
|
|
||
2 years ago
|
export interface AppInfo {
|
||
|
ncSiteUrl: string
|
||
2 years ago
|
authType: 'jwt' | 'none'
|
||
2 years ago
|
connectToExternalDB: boolean
|
||
|
defaultLimit: number
|
||
|
firstUser: boolean
|
||
|
githubAuthEnabled: boolean
|
||
|
googleAuthEnabled: boolean
|
||
|
ncMin: boolean
|
||
|
oneClick: boolean
|
||
|
projectHasAdmin: boolean
|
||
|
teleEnabled: boolean
|
||
|
type: string
|
||
|
version: string
|
||
2 years ago
|
}
|
||
|
|
||
2 years ago
|
export interface StoredState {
|
||
|
token: string | null
|
||
|
user: User | null
|
||
|
lang: string
|
||
|
darkMode: boolean
|
||
2 years ago
|
feedbackForm: FeedbackForm
|
||
2 years ago
|
filterAutoSave: boolean
|
||
2 years ago
|
previewAs: string | null
|
||
2 years ago
|
includeM2M: boolean
|
||
2 years ago
|
currentVersion: string | null
|
||
|
latestRelease: string | null
|
||
|
hiddenRelease: string | null
|
||
2 years ago
|
}
|
||
|
|
||
2 years ago
|
export type State = ToRefs<Omit<StoredState, 'token'>> & {
|
||
2 years ago
|
storage: Ref<StoredState>
|
||
|
token: WritableComputedRef<StoredState['token']>
|
||
2 years ago
|
jwtPayload: ComputedRef<(JwtPayload & User) | null>
|
||
|
timestamp: Ref<number>
|
||
2 years ago
|
runningRequests: ReturnType<typeof useCounter>
|
||
2 years ago
|
error: Ref<any>
|
||
2 years ago
|
appInfo: Ref<AppInfo>
|
||
2 years ago
|
}
|
||
|
|
||
|
export interface Getters {
|
||
|
signedIn: ComputedRef<boolean>
|
||
2 years ago
|
isLoading: WritableComputedRef<boolean>
|
||
2 years ago
|
}
|
||
|
|
||
|
export interface Actions {
|
||
|
signOut: () => void
|
||
|
signIn: (token: string) => void
|
||
2 years ago
|
refreshToken: () => void
|
||
2 years ago
|
}
|
||
|
|
||
|
export type ReadonlyState = Readonly<Pick<State, 'token' | 'user'>> & Omit<State, 'token' | 'user'>
|
||
|
|
||
2 years ago
|
export type UseGlobalReturn = Getters & Actions & ReadonlyState
|