How to use component-cookie - 10 common examples

To help you get started, we’ve selected a few component-cookie examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github creatorsdaily / client.creatorsdaily.com / components / WechatBox.js View on Github external
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)
      })
    }
  })
github creatorsdaily / client.creatorsdaily.com / components / SigninBox.js View on Github external
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 => {
github creatorsdaily / client.creatorsdaily.com / components / SignupBox.js View on Github external
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 => {
github datosgobar / consulta-publica / lib / storage / strategies / cookie.js View on Github external
cookie.remove = (key, fn) => {
  var val = _cookie(key, null)
  if (fn) fn(null, val)
  return this
}
github cube-js / cube.js / examples / real-time-dashboard / dashboard-app / src / tracker.js View on Github external
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"
    }
  });
};
github datosgobar / consulta-publica / lib / storage / strategies / cookie.js View on Github external
cookie.get = (key, fn) => {
  var val = unserialize(_cookie(key))
  if (fn) fn(null, val)
  return val
}
github cube-js / cube.js / packages / cubejs-playground / src / events.js View on Github external
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', {
github cube-js / cube.js / packages / cubejs-playground / src / events.js View on Github external
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;
    }
github cube-js / cube.js / packages / cubejs-playground / src / events.js View on Github external
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) {
github cube-js / cube.js / examples / real-time-dashboard / dashboard-app / src / tracker.js View on Github external
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"
    }
  });
};

component-cookie

Tiny cookie component

MIT
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis

Popular component-cookie functions