Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onSubscriptionData: ({ client, subscriptionData: { data } }) => {
cookie('token', data.miniProgramSignined.token, {
path: '/',
maxage: 7 * 24 * 60 * 60 * 1000
})
client.resetStore().then(() => {
// client.cache.reset().then(() => {
redirect(back)
})
}
})
onCompleted: data => {
cookie('token', data.signin.token, {
path: '/',
maxage: 7 * 24 * 60 * 60 * 1000
})
client.resetStore().then(() => {
// client.cache.reset().then(() => {
redirect(back)
})
},
onError: error => {
onCompleted: data => {
cookie('token', data.signup.token, {
path: '/',
maxage: 7 * 24 * 60 * 60 * 1000
})
client.resetStore().then(() => {
// client.cache.reset().then(() => {
redirect(back)
})
},
onError: error => {
cookie.remove = (key, fn) => {
var val = _cookie(key, null)
if (fn) fn(null, val)
return this
}
const track = (eventName) => {
if (!cookie(COOKIE_NAME)) {
cookie(COOKIE_NAME, uuidv4());
}
fetch(`${URL}/collect`, {
method: "POST",
body: JSON.stringify({
anonymousId: cookie(COOKIE_NAME),
eventType: eventName
}),
headers: {
"Content-Type": "application/json"
}
});
};
cookie.get = (key, fn) => {
var val = unserialize(_cookie(key))
if (fn) fn(null, val)
return val
}
const track = async (event) => {
if (!cookie('playground_anonymous')) {
cookie('playground_anonymous', uuidv4());
}
trackEvents.push({
...event,
id: uuidv4(),
clientAnonymousId: cookie('playground_anonymous'),
clientTimestamp: new Date().toJSON()
});
const flush = async (toFlush, retries) => {
if (!toFlush) {
toFlush = trackEvents;
trackEvents = [];
}
if (!toFlush.length) {
return null;
}
if (retries == null) {
retries = 10;
}
try {
const sentAt = new Date().toJSON();
const result = await fetch('https://track.cube.dev/track', {
const track = async (event) => {
if (!cookie('playground_anonymous')) {
cookie('playground_anonymous', uuidv4());
}
trackEvents.push({
...event,
id: uuidv4(),
clientAnonymousId: cookie('playground_anonymous'),
clientTimestamp: new Date().toJSON()
});
const flush = async (toFlush, retries) => {
if (!toFlush) {
toFlush = trackEvents;
trackEvents = [];
}
if (!toFlush.length) {
return null;
}
const track = async (event) => {
if (!cookie('playground_anonymous')) {
cookie('playground_anonymous', uuidv4());
}
trackEvents.push({
...event,
id: uuidv4(),
clientAnonymousId: cookie('playground_anonymous'),
clientTimestamp: new Date().toJSON()
});
const flush = async (toFlush, retries) => {
if (!toFlush) {
toFlush = trackEvents;
trackEvents = [];
}
if (!toFlush.length) {
return null;
}
if (retries == null) {
const track = (eventName) => {
if (!cookie(COOKIE_NAME)) {
cookie(COOKIE_NAME, uuidv4());
}
fetch(`${URL}/collect`, {
method: "POST",
body: JSON.stringify({
anonymousId: cookie(COOKIE_NAME),
eventType: eventName
}),
headers: {
"Content-Type": "application/json"
}
});
};