Some changes for authentication and getting rid of allScreens component of store as it was causing confusion and breakages.
This commit is contained in:
parent
0fe97feb25
commit
bbe085f734
|
@ -106,10 +106,6 @@ const setPackage = (store, initial) => async pkg => {
|
|||
initial.pages = pkg.pages
|
||||
initial.hasAppPackage = true
|
||||
initial.screens = values(pkg.screens)
|
||||
initial.allScreens = [
|
||||
...Object.values(main_screens),
|
||||
...Object.values(unauth_screens),
|
||||
]
|
||||
initial.builtins = [getBuiltin("##builtin/screenslot")]
|
||||
initial.appInstances = pkg.application.instances
|
||||
initial.appId = pkg.application._id
|
||||
|
@ -139,7 +135,6 @@ const _saveScreen = async (store, s, screen) => {
|
|||
innerState.pages[pageName]._screens = screens
|
||||
innerState.screens = screens
|
||||
innerState.currentPreviewItem = screen
|
||||
innerState.allScreens = [...innerState.allScreens, screen]
|
||||
const safeProps = makePropsSafe(
|
||||
innerState.components[screen.props._component],
|
||||
screen.props
|
||||
|
|
|
@ -52,6 +52,8 @@
|
|||
.map(template => template.create())
|
||||
|
||||
for (let screen of screens) {
|
||||
// record the table that created this screen so we can link it later
|
||||
screen.autoTableId = table._id
|
||||
try {
|
||||
await store.createScreen(screen)
|
||||
} catch (_) {
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
}
|
||||
|
||||
function showModal() {
|
||||
const screens = $store.allScreens
|
||||
templateScreens = screens.filter(screen => screen.props.table === table._id)
|
||||
const screens = $store.screens
|
||||
templateScreens = screens.filter(screen => screen.autoTableId === table._id)
|
||||
willBeDeleted = ["All table data"].concat(
|
||||
templateScreens.map(screen => `Screen ${screen.props._instanceName}`)
|
||||
)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
{:else if parameter.name === 'url'}
|
||||
<DataList on:change bind:value={parameter.value}>
|
||||
<option value="" />
|
||||
{#each $store.allScreens as screen}
|
||||
{#each $store.screens as screen}
|
||||
<option value={screen.route}>{screen.props._instanceName}</option>
|
||||
{/each}
|
||||
</DataList>
|
||||
|
|
|
@ -70,6 +70,7 @@ exports.authenticate = async ctx => {
|
|||
expires,
|
||||
path: "/",
|
||||
httpOnly: false,
|
||||
overwrite: true,
|
||||
})
|
||||
|
||||
ctx.body = {
|
||||
|
|
|
@ -51,6 +51,7 @@ module.exports = async (ctx, next) => {
|
|||
ctx.auth.apiKey = jwtPayload.apiKey
|
||||
ctx.user = {
|
||||
...jwtPayload,
|
||||
instanceId: jwtPayload.instanceId,
|
||||
accessLevel: await getAccessLevel(
|
||||
jwtPayload.instanceId,
|
||||
jwtPayload.accessLevelId
|
||||
|
|
|
@ -15,7 +15,16 @@ module.exports = (ctx, appId, instanceId) => {
|
|||
expiresIn: "30 days",
|
||||
})
|
||||
|
||||
var expiry = new Date()
|
||||
const expiry = new Date()
|
||||
expiry.setDate(expiry.getDate() + 30)
|
||||
ctx.cookies.set("builder:token", token, { expires: expiry, httpOnly: false })
|
||||
// remove the app token
|
||||
ctx.cookies.set("budibase:token", "", {
|
||||
overwrite: true,
|
||||
})
|
||||
// set the builder token
|
||||
ctx.cookies.set("builder:token", token, {
|
||||
expires: expiry,
|
||||
httpOnly: false,
|
||||
overwrite: true,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -27,4 +27,3 @@
|
|||
on:newRow={() => dispatch('newRow')} />
|
||||
</DropdownMenu> -->
|
||||
|
||||
<!--<style ✂prettier:content✂="CiAgZGl2IHsKICAgIGRpc3BsYXk6IGdyaWQ7CiAgICBncmlkLXRlbXBsYXRlLWNvbHVtbnM6IGF1dG8gYXV0bzsKICAgIHBsYWNlLWl0ZW1zOiBzdGFydCBjZW50ZXI7CiAgfQogIGg1IHsKICAgIHBhZGRpbmc6IHZhcigtLXNwYWNpbmcteGwpIDAgMCB2YXIoLS1zcGFjaW5nLXhsKTsKICAgIG1hcmdpbjogMDsKICAgIGZvbnQtd2VpZ2h0OiA1MDA7CiAgfQo=" ✂prettier:content✂="" ✂prettier:content✂="" ✂prettier:content✂="" ✂prettier:content✂="" ✂prettier:content✂="" ✂prettier:content✂=""></style>-->
|
||||
|
|
Loading…
Reference in New Issue