diff --git a/README.md b/README.md index 25eae614..8d4581bc 100755 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@
- - Storyblok Logo - -

Universal JavaScript Client for Storyblok's API

-

This client is a thin wrapper for the Storyblok API's to use in Node.js and the browser.

+ + Storyblok Logo + +

Universal JavaScript Client for Storyblok's API

+

This client is a thin wrapper for the Storyblok API's to use in Node.js and the browser.

@@ -214,16 +214,13 @@ Exceptions will be thrown as an object with the following structure: message: Error // an Error object with the error message status: number response: ISbResponse - message: Error // an Error object with the error message - status: number - response: ISbResponse } ``` where, ```typescript -iinterface ISbResponse { +interface ISbResponse { data: any status: number statusText: string @@ -275,10 +272,6 @@ const data = { name: 'xy', slug: 'xy', }, - story: { - name: 'xy', - slug: 'xy', - }, } Storyblok.get( @@ -291,15 +284,6 @@ Storyblok.get( cache: 'no-cache', body: JSON.stringify(data), } - 'cdn/stories/home', - { - version: 'draft', - }, - { - mode: 'cors', - cache: 'no-cache', - body: JSON.stringify(data), - } ) .then((response) => { console.log(response) @@ -307,12 +291,6 @@ Storyblok.get( .catch((error) => { console.error(error) }) - .then((response) => { - console.log(response) - }) - .catch((error) => { - console.error(error) - }) ``` ### Method `Storyblok#get` @@ -331,7 +309,6 @@ With this method you can get single or multiple items. The multiple items are pa ```javascript Storyblok.get('cdn/stories/home', { version: 'draft', - version: 'draft', }) .then((response) => { console.log(response) @@ -339,12 +316,6 @@ Storyblok.get('cdn/stories/home', { .catch((error) => { console.log(error) }) - .then((response) => { - console.log(response) - }) - .catch((error) => { - console.log(error) - }) ``` #### Method `Storyblok#getAll` @@ -364,7 +335,6 @@ With this method you can get all items at once. ```javascript Storyblok.getAll('cdn/stories', { version: 'draft', - version: 'draft', }) .then((stories) => { console.log(stories) // an array @@ -372,12 +342,6 @@ Storyblok.getAll('cdn/stories', { .catch((error) => { console.log(error) }) - .then((stories) => { - console.log(stories) // an array - }) - .catch((error) => { - console.log(error) - }) ``` #### Method `Storyblok#post` (only management api) @@ -394,7 +358,6 @@ Storyblok.getAll('cdn/stories', { ```javascript Storyblok.post('spaces//stories', { story: { name: 'xy', slug: 'xy' }, - story: { name: 'xy', slug: 'xy' }, }) .then((response) => { console.log(response) @@ -402,12 +365,6 @@ Storyblok.post('spaces//stories', { .catch((error) => { console.log(error) }) - .then((response) => { - console.log(response) - }) - .catch((error) => { - console.log(error) - }) ``` #### Method `Storyblok#put` (only management api) @@ -424,7 +381,6 @@ Storyblok.post('spaces//stories', { ```javascript Storyblok.put('spaces//stories/1', { story: { name: 'xy', slug: 'xy' }, - story: { name: 'xy', slug: 'xy' }, }) .then((response) => { console.log(response) @@ -432,12 +388,6 @@ Storyblok.put('spaces//stories/1', { .catch((error) => { console.log(error) }) - .then((response) => { - console.log(response) - }) - .catch((error) => { - console.log(error) - }) ``` #### Method `Storyblok#delete` (only management api) @@ -459,12 +409,6 @@ Storyblok.delete('spaces//stories/1', null) .catch((error) => { console.log(error) }) - .then((response) => { - console.log(response) - }) - .catch((error) => { - console.log(error) - }) ``` #### Method `Storyblok#flushCache` @@ -761,18 +705,7 @@ import MySchema from 'storyblok-js-client/schema' MySchema.nodes.heading = function (node) { let attrs = {} - let attrs = {} - if ( - node.content && - node.content.length === 1 && - node.content[0].marks && - node.content[0].marks.length === 1 && - node.content[0].marks[0].type === 'styled' - ) { - attrs = node.content[0].marks[0].attrs - delete node.content[0].marks - } if ( node.content && node.content.length === 1 && @@ -792,14 +725,6 @@ MySchema.nodes.heading = function (node) { }, ], } - return { - tag: [ - { - tag: `h${node.attrs.level}`, - attrs: attrs, - }, - ], - } } let rteResolver = new RichTextResolver(MySchema) @@ -836,38 +761,6 @@ let rendered = rteResolver.render({ }, ], type: 'doc', - content: [ - { - content: [ - { - text: 'Normal headline', - type: 'text', - }, - ], - type: 'paragraph', - }, - { - attrs: { - level: 3, - }, - content: [ - { - marks: [ - { - attrs: { - class: 'margin-bottom-fdsafdsada', - }, - type: 'styled', - }, - ], - text: 'Styled headline', - type: 'text', - }, - ], - type: 'heading', - }, - ], - type: 'doc', }) console.log(rendered)