Convert portal admin store to typescript
This commit is contained in:
parent
a706a767a7
commit
0da1dcee48
|
@ -8,7 +8,7 @@ import { get } from "svelte/store"
|
||||||
import { auth, navigation } from "./stores/portal"
|
import { auth, navigation } from "./stores/portal"
|
||||||
|
|
||||||
export const API = createAPIClient({
|
export const API = createAPIClient({
|
||||||
attachHeaders: (headers: Record<string, string>) => {
|
attachHeaders: headers => {
|
||||||
// Attach app ID header from store
|
// Attach app ID header from store
|
||||||
let appId = get(appStore).appId
|
let appId = get(appStore).appId
|
||||||
if (appId) {
|
if (appId) {
|
||||||
|
@ -22,7 +22,7 @@ export const API = createAPIClient({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onError: (error: any) => {
|
onError: error => {
|
||||||
const { url, message, status, method, handled } = error || {}
|
const { url, message, status, method, handled } = error || {}
|
||||||
|
|
||||||
// Log any errors that we haven't manually handled
|
// Log any errors that we haven't manually handled
|
||||||
|
@ -45,7 +45,7 @@ export const API = createAPIClient({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onMigrationDetected: (appId: string) => {
|
onMigrationDetected: appId => {
|
||||||
const updatingUrl = `/builder/app/updating/${appId}`
|
const updatingUrl = `/builder/app/updating/${appId}`
|
||||||
|
|
||||||
if (window.location.pathname === updatingUrl) {
|
if (window.location.pathname === updatingUrl) {
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
declare module "api" {
|
|
||||||
const API: {
|
|
||||||
getPlugins: () => Promise<any>
|
|
||||||
createPlugin: (plugin: object) => Promise<any>
|
|
||||||
uploadPlugin: (plugin: FormData) => Promise<any>
|
|
||||||
deletePlugin: (id: string) => Promise<void>
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,23 +2,26 @@ import { writable, get } from "svelte/store"
|
||||||
import { API } from "api"
|
import { API } from "api"
|
||||||
import { auth } from "stores/portal"
|
import { auth } from "stores/portal"
|
||||||
import { banner } from "@budibase/bbui"
|
import { banner } from "@budibase/bbui"
|
||||||
|
import {
|
||||||
|
ConfigChecklistResponse,
|
||||||
|
GetEnvironmentResponse,
|
||||||
|
SystemStatusResponse,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
export const DEFAULT_CONFIG = {
|
interface PortalAdminStore extends GetEnvironmentResponse {
|
||||||
|
loaded: boolean
|
||||||
|
checklist?: ConfigChecklistResponse
|
||||||
|
status?: SystemStatusResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DEFAULT_CONFIG: PortalAdminStore = {
|
||||||
loaded: false,
|
loaded: false,
|
||||||
multiTenancy: false,
|
multiTenancy: false,
|
||||||
cloud: false,
|
cloud: false,
|
||||||
isDev: false,
|
isDev: false,
|
||||||
disableAccountPortal: false,
|
disableAccountPortal: false,
|
||||||
accountPortalUrl: "",
|
|
||||||
importComplete: false,
|
|
||||||
checklist: {
|
|
||||||
apps: { checked: false },
|
|
||||||
smtp: { checked: false },
|
|
||||||
adminUser: { checked: false },
|
|
||||||
sso: { checked: false },
|
|
||||||
},
|
|
||||||
maintenance: [],
|
|
||||||
offlineMode: false,
|
offlineMode: false,
|
||||||
|
maintenance: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createAdminStore() {
|
export function createAdminStore() {
|
Loading…
Reference in New Issue