Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Observable } from 'rxjs';
import { Book } from 'src/app/shared/books/book.model';
import { addBookAction, booksLoadedAction, loadBooksAction } from '../../store/books/books.actions';
import { BookState } from '../../store/books/books.reducer';
import { selectBook, selectBooks } from '../../store/books/books.selectors';
@Injectable()
export class BookStoreService extends StoreService {
@Select(selectBooks)
getAllBooks: Selector;
@Select(selectBook)
getBook: Selector;
@Dispatch(addBookAction)
addBook: Dispatcher;
@Dispatch(loadBooksAction)
loadBooks: Dispatcher;
@Observe([booksLoadedAction], action => action.books)
booksLoaded$: Observable;
}
import { BookState } from '../../store/books/books.reducer';
import { selectBook, selectBooks } from '../../store/books/books.selectors';
@Injectable()
export class BookStoreService extends StoreService {
@Select(selectBooks)
getAllBooks: Selector;
@Select(selectBook)
getBook: Selector;
@Dispatch(addBookAction)
addBook: Dispatcher;
@Dispatch(loadBooksAction)
loadBooks: Dispatcher;
@Observe([booksLoadedAction], action => action.books)
booksLoaded$: Observable;
}
import { Injectable } from '@angular/core';
import { Dispatch, Dispatcher, Observe, Select, Selector, StoreService } from '@ngxp/store-service';
import { Observable } from 'rxjs';
import { Book } from 'src/app/shared/books/book.model';
import { addBookAction, booksLoadedAction, loadBooksAction } from '../../store/books/books.actions';
import { BookState } from '../../store/books/books.reducer';
import { selectBook, selectBooks } from '../../store/books/books.selectors';
@Injectable()
export class BookStoreService extends StoreService {
@Select(selectBooks)
getAllBooks: Selector;
@Select(selectBook)
getBook: Selector;
@Dispatch(addBookAction)
addBook: Dispatcher;
@Dispatch(loadBooksAction)
loadBooks: Dispatcher;
@Observe([booksLoadedAction], action => action.books)
booksLoaded$: Observable;
}
import { Injectable } from '@angular/core';
import { Dispatch, Dispatcher, Observe, Select, Selector, StoreService } from '@ngxp/store-service';
import { Observable } from 'rxjs';
import { Book } from 'src/app/shared/books/book.model';
import { addBookAction, booksLoadedAction, loadBooksAction } from '../../store/books/books.actions';
import { BookState } from '../../store/books/books.reducer';
import { selectBook, selectBooks } from '../../store/books/books.selectors';
@Injectable()
export class BookStoreService extends StoreService {
@Select(selectBooks)
getAllBooks: Selector;
@Select(selectBook)
getBook: Selector;
@Dispatch(addBookAction)
addBook: Dispatcher;
@Dispatch(loadBooksAction)
loadBooks: Dispatcher;
@Observe([booksLoadedAction], action => action.books)
booksLoaded$: Observable;
}
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent,
],
providers: [
provideStoreServiceMock(BookStoreService)
]
}).compileComponents();
}));
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
AppModule,
NgrxStoreServiceTestingModule
],
providers: [
provideStoreServiceMock(BookStoreService)
]
})
.compileComponents();
}));