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


TypeScript CookieService.put方法代码示例

本文整理汇总了TypeScript中ngx-cookie.CookieService.put方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CookieService.put方法的具体用法?TypeScript CookieService.put怎么用?TypeScript CookieService.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ngx-cookie.CookieService的用法示例。


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

示例1: btoa

 this.userService.login({ email: profile.email, password: btoa(profile.email.split('').reverse().join('')), oauth: true }).subscribe((authentication) => {
   this.cookieService.put('token', authentication.token)
   sessionStorage.setItem('bid', authentication.bid)
   localStorage.setItem('token', authentication.token)
   this.userService.isLoggedIn.next(true)
   this.router.navigate(['/'])
 }, (error) => {
开发者ID:bkimminich,项目名称:juice-shop,代码行数:7,代码来源:oauth.component.ts

示例2: setLocale

    setLocale(code: string) {
        let url = this.ngLocation.prepareExternalUrl('/');

        // The last part of the base path will be the locale
        // Replace it with the selected locale
        url = url.replace(/\/[a-z]{2}-[A-Z]{2}\/$/, `/${code}`);

        // Finally tack the path of the current page back onto the URL
        // which is more friendly than forcing them back to the splash page.
        url += this.ngLocation.path();

        // Set a 10-year locale cookie to maintain compatibility
        // with the AngularJS client.
        // Cookie takes the form aa_bb instead of aa-BB
        const cookie = code.replace(/-/, '_').toLowerCase();
        this.cookieService.put('eg_locale',
            cookie, {path : '/', secure: true, expires: '+10y'});

        window.location.href = url;
    }
开发者ID:jamesrf,项目名称:Evergreen,代码行数:20,代码来源:locale.service.ts

示例3: changeLanguage

 changeLanguage(languageKey: string) {
     this.cookieService.put(LANGUAGE_KEY, languageKey);
     this.jhiLanguageService.changeLanguage(languageKey);
     this.store.dispatch(new LanguageChangedAction(languageKey));
 }
开发者ID:alv-ch,项目名称:job-room,代码行数:5,代码来源:jobroom2-language.service.ts

示例4: setAcceptedConditions

 setAcceptedConditions() {
   console.log('Coach register accept conditions');
   if (this.cookieService.get('ACCEPTS_COOKIES') !== undefined)
     this.cookieService.put('COACH_REGISTER_CONDITIONS_ACCEPTED', 'true');
 }
开发者ID:guillaumeLeRoy,项目名称:eritis_fe,代码行数:5,代码来源:register-coach.component.ts


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