Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dotcms-js

Package Overview
Dependencies
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dotcms-js

Set of components and services which allow you to connect to use data from a dotCMS installation

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-11.11%
Maintainers
1
Weekly downloads
 
Created
Source

DotCMS Angular 2 Library

This is a library of services and components to interact with a DotCMS instance from Angular 2.

Install

npm install dotcms-js --save

Usage

Import Services

import {APP_CONFIG, DOT_CONFIG} from "dotcms-js/core/app.config";
import {FileSystemService} from "dotcms-js/core/util/filesystem.service";
import {HttpClient} from "dotcms-js/core/util/http.service";
import {JWTAuthService} from "dotcms-js/core/util/jwt-auth.service";
import {LocalStoreService} from "dotcms-js/core/util/local-store.service";
import {LoggerService} from "dotcms-js/core/util/logger.service";
import {NotificationService} from "dotcms-js/core/util/notification.service";
import {SettingsStorageService} from "dotcms-js/core/util/settings-storage.service";
import {SiteBrowserService} from "dotcms-js/core/util/site-browser.service";
import {SiteBrowserState} from "dotcms-js/core/util/site-browser.state";

@NgModule({
    providers: [
        {provide: APP_CONFIG, useValue: DOT_CONFIG},
        {provide: FileSystemService, useClass: FileSystemService},
        {provide: HttpClient, useClass: HttpClient},
        {provide: JWTAuthService, useClass: JWTAuthService},
        {provide: LocalStoreService, useClass: LocalStoreService},
        {provide: LoggerService, useClass: LoggerService},
        {provide: NotificationService, useClass: NotificationService},
        {provide: SettingsStorageService, useClass: SettingsStorageService},
        {provide: SiteBrowserService, useClass: SiteBrowserService},
        {provide: SiteBrowserState, useClass: SiteBrowserState}
    ],
})

Authorization

In order to start using the components you need to make sure you have a Auth Token. To get it we provide a login method in the JWTAuthService class.

If the login it's succefull the login method will save an Auth Token to the localStorage in the browser so other services can use it, more info in our documentation.

In this example we are doing the login from the app.component.ts but you can do it from aywhere you need.

import {Component, ViewEncapsulation} from '@angular/core';
import {JWTAuthService} from "dotcms-js/core/util/jwt-auth.service";

@Component({
    selector: 'my-app',
    template: '<h1>My App Component</h1>',
})
export class AppComponent {

    constructor(authService: JWTAuthService) {
        authService.login("http://demo.dotcms.com", "admin@dotcms.com", "admin").subscribe(token => {
            console.log('Login successfully');
        }, (err) => {
            console.log('Error on login', err);
        });
    }
}

Import Components

import {BreadcrumbComponent} from "dotcms-js/components/breadcrumb/breadcrumb.componet";

@NgModule({
    declarations: [
        BreadcrumbComponent
    ],
})
Use the component in your templates
<breadcrumb></breadcrumb>

Changelog

0.0.3

  • Update npmingnore

0.0.2

  • Add login method to JWTAuthService
  • Update showcase login.

0.0.1

Initial commit

To build the project locally

After you clone the repo

  1. npm i
  2. typings install
  3. npm run build

FAQs

Package last updated on 20 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc