strapi/docs/.vuepress/dist/assets/js/69.3f4ed952.js

1 line
94 KiB
JavaScript
Raw Normal View History

2018-10-05 17:24:17 +02:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[69],{238:function(t,s,a){"use strict";a.r(s);var n=a(0),o=Object(n.a)({},function(){var t=this,s=t.$createElement,a=t._self._c||s;return a("div",{staticClass:"content"},[t._m(0),t._v(" "),a("p",[t._v("Strapi provides helpers so you don't have to develop again and again the same generic functions.")]),t._v(" "),t._m(1),t._v(" "),t._m(2),t._v(" "),t._m(3),t._v(" "),t._m(4),t._v(" "),t._m(5),t._m(6),t._v(" "),a("p",[t._v("This function allows to darken a color.")]),t._v(" "),t._m(7),t._v(" "),t._m(8),t._m(9),t._v(" "),a("p",[t._v("The helpers allows to retrieve the query parameters in the URL.")]),t._v(" "),t._m(10),t._v(" "),t._m(11),t._m(12),t._v(" "),a("p",[t._v("A request helper is available to handle all requests inside a plugin.")]),t._v(" "),a("p",[t._v("It takes three arguments:")]),t._v(" "),a("ul",[t._m(13),t._v(" "),a("li",[a("code",[t._v("options")]),t._v(": Please refer to this "),a("a",{attrs:{href:"https://github.com/github/fetch",target:"_blank",rel:"noopener noreferrer"}},[t._v("documentation"),a("OutboundLink")],1),t._v(".")]),t._v(" "),t._m(14)]),t._v(" "),t._m(15),t._v(" "),t._m(16),t._v(" "),t._m(17),t._m(18),t._v(" "),a("p",[t._v("Let's say that we have a container that fetches Content Type configurations depending on URL change.")]),t._v(" "),t._m(19),t._v(" "),t._m(20),t._v(" "),t._m(21),t._v(" "),t._m(22),a("hr"),t._v(" "),t._m(23),t._v(" "),a("p",[t._v("Let's declare the needed constants to handle fetching data:")]),t._v(" "),t._m(24),t._v(" "),t._m(25),a("hr"),t._v(" "),t._m(26),t._v(" "),a("p",[t._v("Let's declare our actions.")]),t._v(" "),t._m(27),t._v(" "),t._m(28),a("hr"),t._v(" "),t._m(29),t._v(" "),a("p",[t._v("Please refer to the "),a("a",{attrs:{href:"https://facebook.github.io/immutable-js/docs/#/",target:"_blank",rel:"noopener noreferrer"}},[t._v("Immutable documentation"),a("OutboundLink")],1),t._v(" for informations about data structure.")]),t._v(" "),t._m(30),t._v(" "),t._m(31),a("hr"),t._v(" "),t._m(32),t._v(" "),t._m(33),t._v(" "),t._m(34),a("hr"),t._v(" "),t._m(35),t._v(" "),t._m(36),t._v(" "),t._m(37),a("hr"),t._v(" "),t._m(38),t._v(" "),t._m(39),t._v(" "),t._m(40),t._v(" "),t._m(41),a("hr"),t._v(" "),t._m(42),t._v(" "),t._m(43),t._v(" "),t._m(44),t._v(" "),t._m(45)])},[function(){var t=this.$createElement,s=this._self._c||t;return s("h1",{attrs:{id:"helpers"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#helpers","aria-hidden":"true"}},[this._v("#")]),this._v(" Helpers")])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"auth"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#auth","aria-hidden":"true"}},[this._v("#")]),this._v(" Auth")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[s("code",[this._v("auth.js")]),this._v(" lets you get, set and delete data in either the browser's "),s("code",[this._v("localStorage")]),this._v(" or "),s("code",[this._v("sessionStorage")]),this._v(".")])},function(){var t=this.$createElement,s=this._self._c||t;return s("h3",{attrs:{id:"methods"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#methods","aria-hidden":"true"}},[this._v("#")]),this._v(" Methods")])},function(){var t=this,s=t.$createElement,a=t._self._c||s;return a("table",[a("thead",[a("tr",[a("th",[t._v("Name")]),t._v(" "),a("th",[t._v("Description")])])]),t._v(" "),a("tbody",[a("tr",[a("td",[t._v("clear(key)")]),t._v(" "),a("td",[t._v("Remove the data in either "),a("code",[t._v("localStorage")]),t._v(" or "),a("code",[t._v("sessionStorage")])])]),t._v(" "),a("tr",[a("td",[t._v("clearAppStorage()")]),t._v(" "),a("td",[t._v("Remove all data from both storage")])]),t._v(" "),a("tr",[a("td",[t._v("clearToken()")]),t._v(" "),a("td",[t._v("Remove the user's "),a("code",[t._v("jwt Token")]),t._v(" in the appropriate browser's storage")])]),t._v(" "),a("tr",[a("td",[t._v("clearUserInfo()")]),t._v(" "),a("td",[t._v("Remove the user's info from storage")])]),t._v(" "),a("tr",[a("td",[t._v("get(key)")]),t._v(" "),a("td",[t._v("Get the item in the browser's storage")])]),