working through auth - adding user instance map
This commit is contained in:
parent
c3f68e9895
commit
2afd1cd4dd
|
@ -1,7 +1,7 @@
|
|||
import { filter, cloneDeep, values } from "lodash/fp"
|
||||
import { pipe } from "components/common/core"
|
||||
import * as backendStoreActions from "./backend"
|
||||
import { writable } from "svelte/store"
|
||||
import { writable, get } from "svelte/store"
|
||||
import api from "../api"
|
||||
import {
|
||||
DEFAULT_PAGES_OBJECT
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
// It's a screen, set it to that screen
|
||||
if ($params.screen !== "page-layout") {
|
||||
store.setCurrentScreen($params.screen)
|
||||
store.setCurrentScreen(decodeURI($params.screen))
|
||||
|
||||
// There are leftover stuff, like IDs, so navigate the components and find the ID and select it.
|
||||
if ($leftover) {
|
||||
|
@ -30,6 +30,7 @@
|
|||
|
||||
// Find Component with ID and continue
|
||||
function findComponent(ids, children) {
|
||||
console.log(ids, children);
|
||||
// Setup stuff
|
||||
let componentToSelect
|
||||
let currentChildren = children
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
import PagesList from "components/userInterface/PagesList.svelte"
|
||||
import IconButton from "components/common/IconButton.svelte"
|
||||
import NewScreen from "components/userInterface/NewScreen.svelte"
|
||||
import CurrentItemPreview from "components/userInterface/CurrentItemPreview.svelte"
|
||||
import SettingsView from "components/userInterface/SettingsView.svelte"
|
||||
import CurrentItemPreview from "components/userInterface/AppPreview"
|
||||
import PageView from "components/userInterface/PageView.svelte"
|
||||
import ComponentsPaneSwitcher from "components/userInterface/ComponentsPaneSwitcher.svelte"
|
||||
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
||||
|
@ -104,7 +103,6 @@
|
|||
</div>
|
||||
|
||||
<NewScreen bind:this={newScreenPicker} />
|
||||
<SettingsView bind:this={settingsView} />
|
||||
|
||||
<ConfirmDialog
|
||||
bind:this={confirmDeleteDialog}
|
||||
|
|
|
@ -24,6 +24,7 @@ exports.create = async function(ctx) {
|
|||
const { id, rev } = await clientDb.post({
|
||||
type: "app",
|
||||
instances: [],
|
||||
userInstanceMap: {},
|
||||
componentLibraries: [
|
||||
"@budibase/standard-components",
|
||||
"@budibase/materialdesign-components"
|
||||
|
|
|
@ -24,6 +24,16 @@ exports.create = async function(ctx) {
|
|||
type: "user"
|
||||
});
|
||||
|
||||
// the clientDB needs to store a map of users against the app
|
||||
const clientDB = new CouchDB(process.env.CLIENT_ID);
|
||||
const app = await clientDB.get(ctx.params.appId);
|
||||
|
||||
app.userInstanceMap = {
|
||||
...app.userInstanceMap,
|
||||
[response._id]: ctx.params.instanceId
|
||||
}
|
||||
await clientDb.put(app);
|
||||
|
||||
ctx.body = {
|
||||
user: {
|
||||
id: response.id,
|
||||
|
|
|
@ -5,7 +5,7 @@ const router = Router();
|
|||
|
||||
router
|
||||
.get("/api/:instanceId/users", controller.fetch)
|
||||
.post("/api/:instanceId/users", controller.create)
|
||||
.post("/api/:appId/:instanceId/users", controller.create)
|
||||
.delete("/api/:instanceId/users/:userId", controller.destroy);
|
||||
|
||||
module.exports = router;
|
Loading…
Reference in New Issue