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"
|
||||
|
||||
export const API = createAPIClient({
|
||||
attachHeaders: (headers: Record<string, string>) => {
|
||||
attachHeaders: headers => {
|
||||
// Attach app ID header from store
|
||||
let appId = get(appStore).appId
|
||||
if (appId) {
|
||||
|
@ -22,7 +22,7 @@ export const API = createAPIClient({
|
|||
}
|
||||
},
|
||||
|
||||
onError: (error: any) => {
|
||||
onError: error => {
|
||||
const { url, message, status, method, handled } = error || {}
|
||||
|
||||
// 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}`
|
||||
|
||||
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 { auth } from "stores/portal"
|
||||
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,
|
||||
multiTenancy: false,
|
||||
cloud: false,
|
||||
isDev: false,
|
||||
disableAccountPortal: false,
|
||||
accountPortalUrl: "",
|
||||
importComplete: false,
|
||||
checklist: {
|
||||
apps: { checked: false },
|
||||
smtp: { checked: false },
|
||||
adminUser: { checked: false },
|
||||
sso: { checked: false },
|
||||
},
|
||||
maintenance: [],
|
||||
offlineMode: false,
|
||||
maintenance: [],
|
||||
}
|
||||
|
||||
export function createAdminStore() {
|
Loading…
Reference in New Issue