diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js
index d7cc857483..0eb5aaaf7a 100644
--- a/packages/builder/src/builderStore/store/backend.js
+++ b/packages/builder/src/builderStore/store/backend.js
@@ -1,12 +1,10 @@
import { writable, get } from "svelte/store"
import { cloneDeep } from "lodash/fp"
import api from "../api"
-import { permissions } from './backend/permissions'
const INITIAL_BACKEND_UI_STATE = {
tables: [],
views: [],
- roles: [],
datasources: [],
queries: [],
integrations: {},
@@ -50,11 +48,6 @@ export const getBackendUiStore = () => {
state.selectedView = state.selectedView
return state
}),
- select: row =>
- store.update(state => {
- state.selectedRow = row
- return state
- }),
},
datasources: {
fetch: async () => {
@@ -301,26 +294,6 @@ export const getBackendUiStore = () => {
})
},
},
- roles: {
- fetch: async () => {
- const response = await api.get("/api/roles")
- const roles = await response.json()
- store.update(state => {
- state.roles = roles
- return state
- })
- },
- delete: async role => {
- const response = await api.delete(`/api/roles/${role._id}/${role._rev}`)
- await store.actions.roles.fetch()
- return response
- },
- save: async role => {
- const response = await api.post("/api/roles", role)
- await store.actions.roles.fetch()
- return response
- },
- },
permissions: {
fetchLevels: async () => {
const response = await api.get("/api/permission/levels")
diff --git a/packages/builder/src/builderStore/store/backend/roles.js b/packages/builder/src/builderStore/store/backend/roles.js
new file mode 100644
index 0000000000..fc8bf57b23
--- /dev/null
+++ b/packages/builder/src/builderStore/store/backend/roles.js
@@ -0,0 +1,30 @@
+import { writable } from "svelte/store"
+import api from "../../api"
+
+function createRolesStore() {
+ const { subscribe, set } = writable([])
+
+ return {
+ subscribe,
+ fetch: async () => {
+ set(await getRoles())
+ },
+ delete: async role => {
+ const response = await api.delete(`/api/roles/${role._id}/${role._rev}`)
+ set(await getRoles())
+ return response
+ },
+ save: async role => {
+ const response = await api.post("/api/roles", role)
+ set(await getRoles())
+ return response
+ },
+ }
+}
+
+async function getRoles() {
+ const response = await api.get("/api/roles")
+ return await response.json()
+}
+
+export const roles = createRolesStore()
diff --git a/packages/builder/src/components/backend/DataTable/cells/RoleCell.svelte b/packages/builder/src/components/backend/DataTable/cells/RoleCell.svelte
index a45f376a3e..784272c534 100644
--- a/packages/builder/src/components/backend/DataTable/cells/RoleCell.svelte
+++ b/packages/builder/src/components/backend/DataTable/cells/RoleCell.svelte
@@ -1,9 +1,9 @@
diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte
index db92abc065..61da9f61bf 100644
--- a/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte
+++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte
@@ -1,5 +1,6 @@
diff --git a/packages/builder/src/pages/[application]/_reset.svelte b/packages/builder/src/pages/[application]/_reset.svelte
index 2411fad0c9..8e34989a23 100644
--- a/packages/builder/src/pages/[application]/_reset.svelte
+++ b/packages/builder/src/pages/[application]/_reset.svelte
@@ -1,5 +1,6 @@