Sha256: dba59020d8b8122dbbba790cffc1d9474ea41df58b3f8807455c500cd960864d

Contents?: true

Size: 632 Bytes

Versions: 2

Compression:

Stored size: 632 Bytes

Contents

import Mutation from './mutation';

import pageflow from 'pageflow';

export default class extends Mutation {
  perform() {
    this._getPageLink().set(this.props.attributes);
  }

  _getPageLink() {
    var pageLink = this._getPage().pageLinks().get(this.props.id);

    if (!pageLink) {
      throw new Error(`Could not find page link with id ${this.props.pageLinkId}.`);
    }

    return pageLink;
  }

  _getPage() {
    var [pageId] = this.props.id.split(':');
    var page = pageflow.pages.getByPermaId(pageId);

    if (!page) {
      throw new Error(`Could not find page with id ${pageId}.`);
    }

    return page;
  }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pageflow-react-0.1.1 js/src/mutations/update_page_link_mutation.js
pageflow-react-0.1.0 js/src/mutations/update_page_link_mutation.js