当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript js-cookie.get函数代码示例

本文整理汇总了TypeScript中js-cookie.get函数的典型用法代码示例。如果您正苦于以下问题:TypeScript get函数的具体用法?TypeScript get怎么用?TypeScript get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

export let getToken = function (): TokenStateSchema | null {
  let user = Cookies.get('user');
  let token = Cookies.get('token');
  if (user !== undefined && token !== undefined) {
    return {token: token, user: user};
  }
  return null;
};
开发者ID:ttsvetanov,项目名称:polyaxon,代码行数:8,代码来源:utils.ts

示例2: loadSessionState

export function loadSessionState() {
    return {
        type: LOAD_SESSION_STATE,
        payload: {
            gitHubAuthToken: cookies.get("gitHubAuthToken"),
            gitHubAuthState: cookies.get("gitHubAuthState"),
        },
    };
}
开发者ID:rx007,项目名称:habitat,代码行数:9,代码来源:gitHub.ts

示例3: setVisitorInfo

  setVisitorInfo() {
    const visitorId = this._config.visitorId
      || Cookies.get(VISITOR_COOKIE_KEY)
      || uuid.v1();
    const sessionId = this._config.sessionId
      || Cookies.get(SESSION_COOKIE_KEY)
      || uuid.v1();

    this.setVisitor(visitorId, sessionId);
  }
开发者ID:groupby,项目名称:searchandiser-ui,代码行数:10,代码来源:tracker.ts

示例4: applyTheme

 /**
  * Applies the theme to the website
  */
 public applyTheme() {
     if (Cookie.get('theme') == 'dark') {
         this.setDarkTheme();
     } else {
         this.setLightTheme();
     }
 }
开发者ID:SimonLoir,项目名称:vicri2.0,代码行数:10,代码来源:dashboard.view.ts

示例5: normalizeBaseURL

export const createAJAXSettings = (
  serverConfig: ServerConfig,
  uri = "/",
  opts: Partial<AjaxRequest> = {}
): AjaxRequest => {
  const baseURL = normalizeBaseURL(serverConfig.endpoint || serverConfig.url);
  const url = `${baseURL}${uri}`;
  // Use the server config provided token if available before trying cookies
  const xsrfToken = serverConfig.xsrfToken || Cookies.get("_xsrf");
  const headers = {
    "X-XSRFToken": xsrfToken,
    Authorization: `token ${serverConfig.token ? serverConfig.token : ""}`
  };

  // Merge in our typical settings for responseType, allow setting additional
  // options like the method
  const settings = {
    url,
    responseType: "json",
    createXHR: () => new XMLHttpRequest(),
    ...serverConfig,
    ...opts,
    // Make sure we merge in the auth headers with user given headers
    headers: { ...headers, ...opts.headers }
  };
  delete settings.endpoint;
  return settings;
};
开发者ID:kelleyblackmore,项目名称:nteract,代码行数:28,代码来源:base.ts

示例6: fetchGitHubRepos

export function fetchGitHubRepos(org, page = 1, username) {
    const token = cookies.get("gitHubAuthToken");
    const urlPath = username ? `users/${username}/repos` : `orgs/${org}/repos`;

    return dispatch => {
        if (page === 1) {
            dispatch(setGitHubReposLoadingFlag(true));
        }

        fetch(`https://api.github.com/${urlPath}?access_token=${token}&per_page=100&page=${page}`).then(response => {
            const links = parseLinkHeader(response.headers.get("Link"));

            // When we get the first page, clear everything out
            if (page === 1) { dispatch(resetGitHubRepos()); }

            if (links && links.next && links.next.page) {
                dispatch(fetchGitHubRepos(org, links.next.page, username));
            } else {
                dispatch(setGitHubReposLoadingFlag(false));
            }

            response.json().then(data => dispatch(populateGitHubRepos(data)));
        });
    };
}
开发者ID:rx007,项目名称:habitat,代码行数:25,代码来源:gitHub.ts

示例7: score_update

    score_update(add_to_score:number) {
        this.max_score = parseInt(Cookies.get('max_score'), 10) || 0;

        this.score += add_to_score;
        if (this.score > this.max_score) {
            Cookies.set('max_score', this.max_score);
        }
    }
开发者ID:rtaycher,项目名称:2048-Clone,代码行数:8,代码来源:game.ts

示例8: addToBasket

  public static addToBasket(item) {
    const basket = JSON.parse(Cookies.get('basket'));
    const {id} = basket;
    const uri = `${ITEM_URI}/${id}/order_items`;
    const data = {size: item.size, shoeModelId: item.id};

    APIUtils.post(uri, data)
      .then(BasketServerActions.receiveBasketItemPush);
  }
开发者ID:nshahpazov,项目名称:shoes-front-end,代码行数:9,代码来源:BasketUtils.ts

示例9: setGitHubAuthState

export function setGitHubAuthState() {
    let payload = cookies.get("gitHubAuthState") || uuid();
    setCookie("gitHubAuthState", payload);

    return {
        type: SET_GITHUB_AUTH_STATE,
        payload
    };
}
开发者ID:rx007,项目名称:habitat,代码行数:9,代码来源:gitHub.ts

示例10: constructor

    constructor(x_size, y_size) {
        this.array = [];
        this.x_size = x_size;
        this.y_size = y_size;
        this.score = 0;
        this.max_score = parseInt(Cookies.get('max_score'), 10) || 0;

        for (let i = 0; i < this.x_size * this.y_size; i++) {
            this.array[i] = null;
        }
    }
开发者ID:rtaycher,项目名称:2048-Clone,代码行数:11,代码来源:game.ts


注:本文中的js-cookie.get函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。