Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Cookies from 'js-cookie'
const app = {
state: {
// δΈθ±ζ
language: Cookies.get('language') || 'zh',
sidebar: {
opened: !+Cookies.get('sidebarStatus')
}
},
mutations: {
TOGGLE_SIDEBAR: state => {
if (state.sidebar.opened) {
Cookies.set('sidebarStatus', 1)
} else {
Cookies.set('sidebarStatus', 0)
}
state.sidebar.opened = !state.sidebar.opened
},
// δΈθ±ζ
SET_LANGUAGE: (state, language) => {
state.language = language
async mounted () {
let userId = Cookies.get('userDetailId')
if (userId !== '' && userId !== undefined) {
this.$Spin.show();
await axios.get(baseURL + '/project-configuration?userId=' + userId).then(res => {
for (let item of res.data.data) {
this.webOptions.push({label: item.websiteName, value: item.id})
}
}).catch(err => {
})
await axios.get(bannertypeUrl + '?userId=' + userId + '&status=true&$paginate=false').then(res=> {
console.log('res.data ::', res.data)
for(let item of res.data) {
let webname = ''
let finx = _.findIndex(this.webOptions, {value: item.website_id})
if (finx !== -1) {
webname = ' (' + this.webOptions[finx].label + ') '
}
mounted() {
this.$Loading.start();
let userId = Cookies.get("userDetailId");
axios({
method: "get",
url: baseUrl + '/subscription-websites',
headers: {
Authorization: Cookies.get("auth_token"),
subscriptionId: Cookies.get("subscriptionId")
}
}).then((response) => {
console.log("------------------------response", response);
if (response.data.data.length == 0) {
this.$Notice.error({
desc: "Websites not available for this subscription",
title: "Error",
duration: 4.5
});
} else {
this.webOptions = response.data.data;
}
this.$Loading.finish();
});
}
};
usingTwitchExperiment: key => this.usingTwitchExperiment(key),
getTwitchAssignment: key => this.getTwitchAssignment(key),
hasTwitchOverride: key => this.hasTwitchOverride(key),
setTwitchOverride: (key, val) => this.setTwitchOverride(key, val),
deleteTwitchOverride: key => this.deleteTwitchOverride(key),
getAssignment: key => this.getAssignment(key),
hasOverride: key => this.hasOverride(key),
setOverride: (key, val) => this.setOverride(key, val),
deleteOverride: key => this.deleteOverride(key),
on: (...args) => this.on(...args),
off: (...args) => this.off(...args)
});
this.unique_id = Cookie.get('unique_id');
this.Cookie = Cookie;
this.experiments = {};
this.cache = new Map;
}
handleTrialBannerDismiss() {
this.toggleMainNavbarMargin(false);
this.toggleSecondaryNavbarMargin(false);
if (Cookies.get(this.COOKIE_KEY)) {
Cookies.set(this.COOKIE_KEY, 'false');
}
}
}
export const getStorage = (key, defaultValue) => {
if (typeof window !== 'undefined') {
return Cookies.get(key) ? JSON.parse(Cookies.get(key)) : defaultValue
}
return defaultValue
}
import Cookies from 'js-cookie'
const app = {
state: {
sidebar: {
opened: !+Cookies.get('sidebarStatus'),
withoutAnimation: false
},
device: 'desktop',
language: Cookies.get('language') || 'en',
size: Cookies.get('size') || 'medium'
},
mutations: {
TOGGLE_SIDEBAR: state => {
if (state.sidebar.opened) {
Cookies.set('sidebarStatus', 1)
} else {
Cookies.set('sidebarStatus', 0)
}
state.sidebar.opened = !state.sidebar.opened
state.sidebar.withoutAnimation = false
},
CLOSE_SIDEBAR: (state, withoutAnimation) => {
Cookies.set('sidebarStatus', 1)
state.sidebar.opened = false
state.sidebar.withoutAnimation = withoutAnimation
data() {
return {
isResolvedCommentsPopoverHidden: parseBoolean(Cookies.get(this.$options.cookieKey)),
discussionWithOpenForm: '',
};
},
computed: {
get (ctx) {
return Cookies.get()
}
}