Socket
Socket
Sign inDemoInstall

croud-layout

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

croud-layout - npm Package Compare versions

Comparing version 1.0.12 to 1.0.13

20

package.json
{
"name": "croud-layout",
"main": "src/plugin.js",
"version": "1.0.12",
"version": "1.0.13",
"description": "A Vue.js project",

@@ -34,2 +34,3 @@ "author": "Brock <brock.reece@croud.co.uk>",

"babel-preset-env": "^1.3.2",
"babel-preset-latest": "^6.24.1",
"babel-preset-stage-2": "^6.22.0",

@@ -45,2 +46,3 @@ "babel-register": "^6.22.0",

"eslint-config-airbnb-base": "^11.1.3",
"eslint-config-croud": "^1.0.1",
"eslint-friendly-formatter": "^2.0.7",

@@ -70,2 +72,3 @@ "eslint-import-resolver-webpack": "^0.8.1",

"mocha": "^3.2.0",
"node-sass": "^4.5.3",
"opn": "^4.0.2",

@@ -76,2 +79,3 @@ "optimize-css-assets-webpack-plugin": "^1.3.0",

"rimraf": "^2.6.0",
"sass-loader": "^6.0.3",
"semver": "^5.3.0",

@@ -82,5 +86,9 @@ "shelljs": "^0.7.6",

"url-loader": "^0.5.8",
"vue": "^2.2.6",
"vue-loader": "^11.3.4",
"vue-resource": "^1.3.1",
"vue-semantic": "https://github.com/CroudSupport/vue-semantic.git#vue2",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.2.6",
"vuex": "^2.3.1",
"webpack": "^2.3.3",

@@ -90,11 +98,3 @@ "webpack-bundle-analyzer": "^2.2.1",

"webpack-hot-middleware": "^2.18.0",
"webpack-merge": "^4.1.0",
"babel-preset-latest": "^6.24.1",
"eslint-config-croud": "^1.0.1",
"node-sass": "^4.5.2",
"sass-loader": "^6.0.3",
"vue": "^2.2.6",
"vue-resource": "^1.3.1",
"vue-semantic": "https://github.com/CroudSupport/vue-semantic.git#vue2",
"vuex": "^2.3.1"
"webpack-merge": "^4.1.0"
},

@@ -101,0 +101,0 @@ "engines": {

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import VueResource from 'vue-resource'
import App from './App'
import store from './store'
// import storePlugin from './store/plugin'
import axios from './axios'
import '../semantic/dist/semantic.min'

@@ -14,19 +12,4 @@ import '../semantic/dist/semantic.min.css'

Vue.config.productionTip = false
Vue.use(VueResource)
// Vue.use(storePlugin, { store })
Vue.use(require('vue-semantic'))
// window.Croud = {
// systemSettings: {
// user: {},
// },
// user_switcher: {
// users: [],
// org_user: {},
// root_user: {},
// current_user: {},
// },
// navigation: {},
// }
/* eslint-disable no-new */

@@ -38,2 +21,5 @@ new Vue({

store,
created() {
Vue.use(axios, { setCroudDefaults: true })
},
})

@@ -0,1 +1,2 @@

import Vue from 'vue'
import localforage from 'localforage'

@@ -5,7 +6,14 @@ import jwtDecode from 'jwt-decode'

const jwt = localStorage.getItem('jwt') ? jwtDecode(localStorage.getItem('jwt')) : {}
const rootJwt = localStorage.getItem('root') ? jwtDecode(localStorage.getItem('root')) : {}
localforage.config({
const current = localforage.createInstance({
name: jwt.sub,
})
export default localforage
export const rootStore = localforage.createInstance({
name: rootJwt.sub,
})
Vue.localForage = current
export default current

@@ -0,3 +1,5 @@

import Vue from 'vue'
import jwtDecode from 'jwt-decode'
import localforage from '../localForage'
import localforage from 'localforage'
import { rootStore } from '../localForage'

@@ -7,5 +9,7 @@ export default {

user: {},
rootUser: {},
permissions: [],
userSwitches: [],
jwt: localStorage.getItem('jwt') ? jwtDecode(localStorage.getItem('jwt')) : {},
root: localStorage.getItem('root') ? jwtDecode(localStorage.getItem('root')) : {},
loading: true,

@@ -17,2 +21,5 @@ },

},
UPDATE_ROOT_USER(state, newState) {
state.rootUser = newState
},
UPDATE_PERMISSIONS(state, newState) {

@@ -33,15 +40,41 @@ state.permissions = newState

updateUser: (context, state) => {
localforage.setItem('updateUser', state)
Vue.localForage.setItem('updateUser', state)
context.commit('UPDATE_USER', state)
},
updateRootUser: (context, state) => {
context.commit('UPDATE_ROOT_USER', state)
},
updatePermissions: (context, state) => {
localforage.setItem('updatePermissions', state)
Vue.localForage.setItem('updatePermissions', state)
context.commit('UPDATE_PERMISSIONS', state)
},
updateUserSwitches: (context, state) => {
localforage.setItem('updateUserSwitches', state)
Vue.localForage.setItem('updateUserSwitches', state)
context.commit('UPDATE_USER_SWITCHES', state)
},
updateJWT: context => context.commit('UPDATE_JWT'),
updateJWT: (context) => {
context.commit('UPDATE_JWT')
const jwt = localStorage.getItem('jwt')
Vue.prototype.$http.defaults.headers.common.Authorization = `Bearer ${jwt}`
Vue.http.defaults.headers.common.Authorization = `Bearer ${jwt}`
Vue.localForage = localforage.createInstance({
name: jwtDecode(jwt).sub,
})
return context.dispatch('auth')
},
auth: context => Vue.http.get('api/user/authorised').then((response) => {
response.body.data.user.data.avatar = response.body.data.user.data.avatar_url
context.dispatch('updateUser', response.body.data.user.data)
context.dispatch('updatePermissions', response.body.data.permissions.data)
if (!context.getters.root.sub || context.getters.root.sub === context.getters.jwt.sub) {
context.dispatch('updateUserSwitches', response.body.data.user_switches.data)
}
}).catch(() => {
context.dispatch('updateUser', {})
}),
$init: (context) => {

@@ -53,12 +86,26 @@ if (!localStorage.getItem('jwt')) {

localforage.getItem('updateUser').then((data) => {
Vue.localForage.getItem('updateUser').then((data) => {
if (data) context.commit('UPDATE_USER', data)
if (!context.getters.root.sub) context.commit('UPDATE_ROOT_USER', data)
context.commit('STOP_LOADING')
})
localforage.getItem('updatePermissions').then((data) => {
Vue.localForage.getItem('updatePermissions').then((data) => {
if (data) context.commit('UPDATE_PERMISSIONS', data)
})
localforage.getItem('updateUserSwitches').then((data) => {
if (data) context.commit('UPDATE_USER_SWITCHES', data)
})
if (!context.getters.root.sub) {
Vue.localForage.getItem('updateUserSwitches').then((data) => {
if (data) context.commit('UPDATE_USER_SWITCHES', data)
})
} else if (context.getters.root.sub !== context.getters.jwt.sub) {
rootStore.getItem('updateUserSwitches').then((data) => {
if (data) context.commit('UPDATE_USER_SWITCHES', data)
})
rootStore.getItem('updateUser').then((data) => {
if (data) context.commit('UPDATE_ROOT_USER', data)
context.commit('STOP_LOADING')
})
}
},

@@ -68,2 +115,3 @@ },

user: state => state.user,
rootUser: state => state.rootUser,
clients: (state) => {

@@ -76,2 +124,3 @@ if (!state.user.allTeamClients) return []

jwt: state => state.jwt,
root: state => state.root,
loading: state => state.loading,

@@ -78,0 +127,0 @@ effectivePermissions: (state) => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc