Skip to content

Commit

Permalink
Include cloud authentication if no other auth is used
Browse files Browse the repository at this point in the history
  • Loading branch information
benmerckx committed Jan 11, 2024
1 parent 76ba10a commit 8cc2654
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 1 addition & 7 deletions src/core/CMS.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {Store} from 'alinea/backend/Store'
import {CloudAuthView} from 'alinea/cloud/view/CloudAuth'
import {Resolver} from 'alinea/core'
import {Config, DashboardConfig, createConfig} from './Config.js'
import {Config, createConfig} from './Config.js'
import {Graph, GraphRealm, GraphRealmApi} from './Graph.js'
import {Root} from './Root.js'
import {Workspace} from './Workspace.js'
Expand All @@ -15,7 +14,6 @@ export interface CMSApi extends GraphRealmApi {
}

export abstract class CMS extends GraphRealm implements CMSApi {
dashboard: DashboardConfig
graph: Graph
config: Config

Expand All @@ -26,10 +24,6 @@ export abstract class CMS extends GraphRealm implements CMSApi {
return cnx.resolve(params)
})
this.config = normalizedConfig
this.dashboard = {
auth: CloudAuthView,
...(config.dashboard as DashboardConfig)
}
this.graph = new Graph(normalizedConfig, async params => {
const {resolve} = await this.resolver()
return resolve(params)
Expand Down
7 changes: 6 additions & 1 deletion src/core/Config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {CloudAuthView} from 'alinea/cloud/view/CloudAuth'
import {MediaSchema} from 'alinea/core/media/MediaSchema'
import {ComponentType} from 'react'
import {Auth} from './Auth.js'
Expand Down Expand Up @@ -67,6 +68,10 @@ export function createConfig<Definition extends Config>(
const handlerUrl = definition.handlerUrl ?? definition.dashboard?.handlerUrl*/
return {
...definition,
schema: {...MediaSchema, ...definition.schema}
schema: {...MediaSchema, ...definition.schema},
dashboard: {
auth: CloudAuthView,
...definition.dashboard
}
}
}

0 comments on commit 8cc2654

Please sign in to comment.