{"id":312436,"date":"2020-11-02T15:01:14","date_gmt":"2020-11-02T15:01:14","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=312436"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=312436","title":{"rendered":"\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0438\u043f\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0432\u043e Vuex"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p>Vuex \u2014 \u044d\u0442\u043e \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u0430\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 Vue.js.<\/p>\n<p>  <\/p>\n<p>Vuex \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0443\u0436\u0438\u0442 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e \u043c\u0435\u0440\u0435 \u0440\u043e\u0441\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0440\u0430\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u044b \u0432 \u043e\u0434\u0438\u043d \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442. <\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432\u043e Vuex \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0442 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043d\u0430 <a href=\"https:\/\/vuex.vuejs.org\/ru\/guide\/modules.html\">\u043c\u043e\u0434\u0443\u043b\u0438<\/a>. \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0430\u043a\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u043c\u0443\u0442\u0430\u0446\u0438\u0438, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u0438.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u044f \u043d\u0430\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c CloudBlue Connect \u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u043c\u044b \u043f\u043e\u0439\u043c\u0430\u043b\u0438 \u0441\u0435\u0431\u044f \u043d\u0430 \u043c\u044b\u0441\u043b\u0438, \u0447\u0442\u043e \u043f\u0438\u0448\u0435\u043c \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u043d\u043e\u0432\u0430 \u0438 \u0441\u043d\u043e\u0432\u0430, \u043c\u0435\u043d\u044f\u044f \u043b\u0438\u0448\u044c \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u0435\u043a\u0435\u043d\u0434\u043e\u043c;<\/li>\n<li>\u041c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f Vuex, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u043c;<\/li>\n<li>\u042e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u0432 \u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043e\u0434\u043d\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435 \u0438\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430\u043c\u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438. \u0418 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043c\u044b \u043b\u044e\u0431\u0438\u043c \u0432\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u041f\u043e\u043c\u0438\u043c\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u0432 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u0435 \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443, \u044d\u0442\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0431\u0430\u0433\u043e\u0432 \u0432 \u043a\u043e\u0434\u0435. <\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u0442\u0438\u043f\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 Vuex, \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0432\u0448\u0443\u044e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043e \u043d\u0443\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u0435\u043a\u0435\u043d\u0434\u043e\u043c \u0438 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c (\u0441\u0442\u043e\u0440\u043e\u043c).<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"sozdanie-fabriki-moduley-vuex\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0430\u0431\u0440\u0438\u043a\u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 Vuex<\/h2>\n<p>  <\/p>\n<h3 id=\"1-bazovyy-repozitoriy\">1. \u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/h3>\n<p>  <\/p>\n<p>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 <code>BaseRepository<\/code> \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0431\u0435\u043a\u0435\u043d\u0434\u043e\u043c \u0447\u0435\u0440\u0435\u0437 REST API. \u0422\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0435 CRUD-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0430 \u043b\u0438\u0448\u044c \u0437\u0430\u043e\u0441\u0442\u0440\u044e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0430\u0440\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0438, \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e, \u0432\u0435\u0440\u0441\u0438\u044e API.<br \/>  \u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u0445 \u0431\u0443\u0434\u0435\u0442 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <code>\/v1\/users<\/code>).<\/p>\n<p>  <\/p>\n<p>\u0415\u0449\u0451 \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0434\u0432\u0430 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430:<br \/>  \u2014 <code>query<\/code> \u2014 \u0432\u0441\u0435\u0433\u043e \u043d\u0430\u0432\u0441\u0435\u0433\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. <\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">class BaseRepository {     constructor(entity, version = 'v1') {         this.entity = entity;         this.version = version;     }      get endpoint() {         return `\/${this.version}\/${this.entity}`;     }      async query({         method = 'GET',         nestedEndpoint = '',         urlParameters = {},         queryParameters = {},         data = undefined,         headers = {},     }) {         const url = parameterize(`${this.endpoint}${nestedEndpoint}`, urlParameters);          const result = await axios({             method,             url,             headers,             data,             params: queryParameters,         });          return result;     }      ... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u2014 <code>getTotal<\/code> \u2014 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<br \/>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a <a href=\"https:\/\/developer.mozilla.org\/ru\/docs\/Web\/HTTP\/Headers\/Content-Range\">Content-Range<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432: <code>Content-Range: &lt;unit&gt; &lt;range-start&gt;-&lt;range-end&gt;\/&lt;size&gt;<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ getContentRangeSize :: String -&gt; Integer \/\/ getContentRangeSize :: &quot;Content-Range: items 0-137\/138&quot; -&gt; 138 const getContentRangeSize = header =&gt; +\/(\\w+) (\\d+)-(\\d+)\\\/(\\d+)\/g.exec(header)[4];  ...  async getTotal(urlParameters, queryParameters = {}) {     const { headers } = await this.query({         queryParameters: { ...queryParameters, limit: 1 },         urlParameters,     });      if (!headers['Content-Range']) {         throw new Error('Content-Range header is missing');     }      return getContentRangeSize(headers['Content-Range']); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043a\u043b\u0430\u0441\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li><code>listAll<\/code> \u2014 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e;<\/li>\n<li><code>list<\/code> \u2014 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e (\u0441 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0435\u0439);<\/li>\n<li><code>get<\/code> \u2014 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442;<\/li>\n<li><code>create<\/code> \u2014 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442;<\/li>\n<li><code>update<\/code> \u2014 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442;<\/li>\n<li><code>delete<\/code> \u2014 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u0440\u043e\u0441\u0442\u044b: \u043e\u043d\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043d\u0443\u0436\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<p>  <\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u044f\u0441\u043d\u044e \u043c\u0435\u0442\u043e\u0434 <code>listAll<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0432\u0441\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0435\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b. \u0421\u043f\u0435\u0440\u0432\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>getTotal<\/code>, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0417\u0430\u0442\u0435\u043c \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u0430\u0447\u043a\u0430\u043c\u0438 \u043f\u043e <code>chunkSize<\/code> \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0438\u0445 \u0432 \u043e\u0434\u043d\u0443 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e. <\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u043e\u0439.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">BaseRepository.js<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">import axios from 'axios';  \/\/ parameterize :: replace substring in string by template \/\/ parameterize :: Object -&gt; String -&gt; String \/\/ parameterize :: {userId: '123'} -&gt; '\/users\/:userId\/activate' -&gt; '\/users\/123\/activate' const parameterize = (url, urlParameters) =&gt; Object.entries(urlParameters)   .reduce(     (a, [key, value]) =&gt; a.replace(`:${key}`, value),      url,   );  \/\/ responsesToCollection :: Array -&gt; Array \/\/ responsesToCollection :: [{data: [1, 2]}, {data: [3, 4]}] -&gt; [1, 2, 3, 4] const responsesToCollection = responses =&gt; responses.reduce((a, v) =&gt; a.concat(v.data), []);  \/\/ getContentRangeSize :: String -&gt; Integer \/\/ getContentRangeSize :: &quot;Content-Range: items 0-137\/138&quot; -&gt; 138 const getContentRangeSize = header =&gt; +\/(\\w+) (\\d+)-(\\d+)\\\/(\\d+)\/g.exec(header)[4];  \/\/ getCollectionAndTotal :: Object -&gt; Object \/\/ getCollectionAndTotal :: { data, headers } -&gt; { collection, total } const getCollectionAndTotal = ({ data, headers }) =&gt; ({   collection: data,   total: headers['Content-Range'] &amp;&amp; getContentRangeSize(headers['Content-Range']), })  export default class BaseRepository {   constructor(entity, version = 'v1') {     this.entity = entity;     this.version = version;   }    get endpoint() {     return `\/${this.version}\/${this.entity}`;   }    async query({     method = 'GET',     nestedEndpoint = '',     urlParameters = {},     queryParameters = {},     data = undefined,     headers = {},   }) {     const url = parameterize(`${this.endpoint}${nestedEndpoint}`, urlParameters);      const result = await axios({       method,       url,       headers,       data,       params: queryParameters,     });      return result;   }    async getTotal(urlParameters, queryParameters = {}) {     const { headers } = await this.query({        queryParameters: { ...queryParameters, limit: 1 },       urlParameters,     });      if (!headers['Content-Range']) {       throw new Error('Content-Range header is missing');     }      return getContentRangeSize(headers['Content-Range']);   }    async list(queryParameters, urlParameters) {     const result = await this.query({ urlParameters, queryParameters });      return {        ...getCollectionAndTotal(result),       params: queryParameters,     };   }    async listAll(queryParameters = {}, urlParameters, chunkSize = 100) {     const params = {        ...queryParameters,       offset: 0,       limit: chunkSize,     };      const requests = [];     const total = await this.getTotal(urlParameters, queryParameters);      while (params.offset &lt; total) {       requests.push(         this.query({            urlParameters,            queryParameters: params,         }),       );        params.offset += chunkSize;     }      const result = await Promise.all(requests);      return {       total,       params: {         ...queryParameters,         offset: 0,         limit: total,       },       collection: responsesToCollection(result),     };   }    async create(requestBody, urlParameters) {     const { data } = await this.query({       method: 'POST',       urlParameters,       data: requestBody,     });      return data;   }    async get(id = '', urlParameters, queryParameters = {}) {     const { data } = await this.query({       method: 'GET',       nestedEndpoint: `\/${id}`,       urlParameters,       queryParameters,     });      return data;   }    async update(id = '', requestBody, urlParameters) {     const { data } = await this.query({       method: 'PUT',       nestedEndpoint: `\/${id}`,       urlParameters,       data: requestBody,     });      return data;   }    async delete(id = '', requestBody, urlParameters) {     const { data } = await this.query({       method: 'DELETE',       nestedEndpoint: `\/${id}`,       urlParameters,       data: requestBody,     });      return data;   } }<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0430\u0448\u0438\u043c API, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430.<br \/>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437 \u0440\u0435\u0441\u0443\u0440\u0441\u0430 <code>users<\/code> \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f: <\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const usersRepository = new BaseRepository('users'); const win0err = await usersRepository.get('USER-007');<\/code><\/pre>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f?<br \/>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u043e\u0441\u043b\u0430\u0432 POST-\u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 <code>\/v1\/users\/:id\/activate<\/code>.<br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">class UsersRepository extends BaseRepository {     constructor() {         super('users');     }      activate(id) {         \/\/ POST \/v1\/users\/:id\/activate         return this.query({             nestedEndpoint: '\/:id\/activate',             method: 'POST',             urlParameters: { id },         });     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441 API \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const usersRepository = new UsersRepository(); await usersRepository.activate('USER-007'); await usersRepository.listAll();<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"2-fabrika-hranilischa\">2. \u0424\u0430\u0431\u0440\u0438\u043a\u0430 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430<\/h3>\n<p>  <\/p>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043c\u043e\u0434\u0443\u043b\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0445\u043e\u0436\u0435\u0439.<br \/>  \u042d\u0442\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u0438\u043f\u043e\u0432\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438. \u0422\u0430\u043a\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u043c\u0443\u0442\u0430\u0446\u0438\u0438, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0438 \u0433\u0435\u0442\u0442\u0435\u0440\u044b.<\/p>\n<p>  <\/p>\n<h4 id=\"mutacii\">\u041c\u0443\u0442\u0430\u0446\u0438\u0438<\/h4>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u043d\u043e\u0439 \u043c\u0443\u0442\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<br \/>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <code>value<\/code> \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0442\u0430\u043a \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">import {     is,     clone, } from 'ramda';  const mutations = {     replace: (state, { obj, value }) =&gt; {         const data = clone(state[obj]);          state[obj] = is(Function, value) ? value(data) : value;     }, }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"sostoyanie-i-gettery\">\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438 \u0433\u0435\u0442\u0442\u0435\u0440\u044b<\/h4>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e, \u043b\u0438\u0431\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438.<br \/>  \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0440\u0451\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<ul>\n<li><code>collection<\/code> \u2014 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f;<\/li>\n<li><code>current<\/code> \u2014 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442;<\/li>\n<li><code>total<\/code> \u2014 \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/li>\n<\/ul>\n<p>  <\/p>\n<h4 id=\"eksheny\">\u042d\u043a\u0448\u0435\u043d\u044b<\/h4>\n<p>  <\/p>\n<p>\u0412 \u043c\u043e\u0434\u0443\u043b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u044d\u043a\u0448\u0435\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c\u0438 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438: <code>get<\/code>, <code>list<\/code>, <code>listAll<\/code>, <code>create<\/code>, <code>update<\/code> \u0438 <code>delete<\/code>. \u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044f \u0441 \u0431\u0435\u043a\u0435\u043d\u0434\u043e\u043c, \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441 \u0431\u0435\u043a\u0435\u043d\u0434\u043e\u043c.<\/p>\n<p>  <\/p>\n<h4 id=\"fabrika-hranilisch\">\u0424\u0430\u0431\u0440\u0438\u043a\u0430 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449<\/h4>\n<p>  <\/p>\n<p>\u0424\u0430\u0431\u0440\u0438\u043a\u0430 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u0442\u043e\u0440\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>registerModule<\/code>: <code>store.registerModule(name, module);<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0447\u043d\u044b\u0439 \u0441\u0442\u043e\u0440, \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0434\u043c\u0435\u0448\u0430\u043d\u044b \u043a \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0443 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">StoreFactory.js<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">import {   clone,   is,   mergeDeepRight, } from 'ramda';  const keyBy = (pk, collection) =&gt; {   const keyedCollection = {};   collection.forEach(       item =&gt; keyedCollection[item[pk]] = item,   );    return keyedCollection; }  const replaceState = (state, { obj, value }) =&gt; {   const data = clone(state[obj]);    state[obj] = is(Function, value) ? value(data) : value; };  const updateItemInCollection = (id, item) =&gt; collection =&gt; {   collection[id] = item;    return collection };  const removeItemFromCollection = id =&gt; collection =&gt; {   delete collection[id];    return collection };  const inc = v =&gt; ++v; const dec = v =&gt; --v;  export const createStore = (repository, primaryKey = 'id') =&gt; ({   namespaced: true,    state: {     collection: {},     currentId: '',      total: 0,   },    getters: {     collection: ({ collection }) =&gt; Object.values(collection),     total: ({ total }) =&gt; total,     current: ({ collection, currentId }) =&gt; collection[currentId],   },    mutations: {     replace: replaceState,   },    actions: {     async list({ commit }, attrs = {}) {       const { queryParameters = {}, urlParameters = {} } = attrs;        const result = await repository.list(queryParameters, urlParameters);        commit({         obj: 'collection',         type: 'replace',         value: keyBy(primaryKey, result.collection),       });        commit({         obj: 'total',         type: 'replace',         value: result.total,       });        return result;     },      async listAll({ commit }, attrs = {}) {       const {         queryParameters = {},         urlParameters = {},         chunkSize = 100,       } = attrs;        const result = await repository.listAll(queryParameters, urlParameters, chunkSize)        commit({         obj: 'collection',         type: 'replace',         value: keyBy(primaryKey, result.collection),       });        commit({         obj: 'total',         type: 'replace',         value: result.total,       });        return result;     },      async get({ commit, getters }, attrs = {}) {       const { urlParameters = {}, queryParameters = {} } = attrs;       const id = urlParameters[primaryKey];        try {         const item = await repository.get(           id,           urlParameters,           queryParameters,         );          commit({           obj: 'collection',           type: 'replace',           value: updateItemInCollection(id, item),         });          commit({           obj: 'currentId',           type: 'replace',           value: id,         });       } catch (e) {         commit({           obj: 'currentId',           type: 'replace',           value: '',         });          throw e;       }        return getters.current;     },      async create({ commit, getters }, attrs = {}) {       const { data, urlParameters = {} } = attrs;        const createdItem = await repository.create(data, urlParameters);       const id = createdItem[primaryKey];        commit({         obj: 'collection',         type: 'replace',         value: updateItemInCollection(id, createdItem),       });        commit({         obj: 'total',         type: 'replace',         value: inc,       });        commit({         obj: 'current',         type: 'replace',         value: id,       });        return getters.current;     },      async update({ commit, getters }, attrs = {}) {       const { data, urlParameters = {} } = attrs;       const id = urlParameters[primaryKey];        const item = await repository.update(id, data, urlParameters);        commit({         obj: 'collection',         type: 'replace',         value: updateItemInCollection(id, item),       });        commit({         obj: 'current',         type: 'replace',         value: id,       });        return getters.current;     },      async delete({ commit }, attrs = {}) {       const { urlParameters = {}, data } = attrs;       const id = urlParameters[primaryKey];        await repository.delete(id, urlParameters, data);        commit({         obj: 'collection',         type: 'replace',         value: removeItemFromCollection(id),       });        commit({         obj: 'total',         type: 'replace',         value: dec,       });     },   }, });  const StoreFactory = (repository, extension = {}) =&gt; {   const genericStore = createStore(     repository,      extension.primaryKey || 'id',   );    ['state', 'getters', 'actions', 'mutations'].forEach(     part =&gt; {       genericStore[part] = mergeDeepRight(         genericStore[part],         extension[part] || {},       );     }   )    return genericStore; };  export default StoreFactory;<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h4 id=\"primer-ispolzovaniya\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/h4>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const usersRepository = new UsersRepository(); const usersModule = StoreFactory(usersRepository);<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u044d\u043a\u0448\u0435\u043d.<br \/>  \u041f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u0435\u0433\u043e \u043a\u0430\u043a \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">import { assoc } from 'ramda';  const usersRepository = new UsersRepository(); const usersModule = StoreFactory(     usersRepository,     {         actions: {             async activate({ commit }, { urlParameters }) {                 const { id } = urlParameters;                 const item = await usersRepository.activate(id);                  commit({                     obj: 'collection',                     type: 'replace',                     value: assoc(id, item),                 });             }         }     }, );<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"3-fabrika-resursov\">3. \u0424\u0430\u0431\u0440\u0438\u043a\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432<\/h3>\n<p>  <\/p>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0451 \u0432\u043c\u0435\u0441\u0442\u0435 \u0432 \u0435\u0434\u0438\u043d\u0443\u044e \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439, \u0437\u0430\u0442\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u0441\u0442\u043e\u0440\u0435:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">ResourceFactory.js<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">import BaseRepository from '.\/BaseRepository'; import StoreFactory from '.\/StoreFactory';  const createRepository = (endpoint, repositoryExtension = {}) =&gt; {   const repository = new BaseRepository(endpoint, 'v1');    return Object.assign(repository, repositoryExtension); }  const ResourceFactory = (   store,   {     name,     endpoint,     repositoryExtension = {},     storeExtension = () =&gt; ({}),   }, ) =&gt; {     const repository = createRepository(endpoint, repositoryExtension);     const module = StoreFactory(repository, storeExtension(repository));      store.registerModule(name, module); }  export default ResourceFactory;<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h2 id=\"primer-ispolzovaniya-fabriki-resursov\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0430\u0431\u0440\u0438\u043a\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432<\/h2>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 (\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f) \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const store = Vuex.Store();  ResourceFactory(     store,     {         name: 'users',         endpoint: 'users',         repositoryExtension: {             activate(id) {                 return this.query({                     nestedEndpoint: '\/:id\/activate',                     method: 'POST',                     urlParameters: { id },                 });             },         },         storeExtension: (repository) =&gt; ({             actions: {                 async activate({ commit }, { urlParameters }) {                     const { id } = urlParameters;                     const item = await repository.activate(id);                      commit({                         obj: 'collection',                         type: 'replace',                         value: assoc(id, item),                     });                 }             }         }),     }, );<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043e\u0434\u043d\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430: \u043c\u044b \u0437\u0430\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u044b\u0435 \u0438\u043c\u0435\u043d\u0430 \u0434\u043b\u044f \u044d\u043a\u0448\u0435\u043d\u043e\u0432 \u0438 \u0433\u0435\u0442\u0442\u0435\u0440\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0439 \u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u0445:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">{     computed: {         ...mapGetters('users', {             users: 'collection',             totalUsers: 'total',             currentUser: 'current',         }),          ...mapGetters('groups', {             users: 'collection',         }),          ...     },      methods: {         ...mapActions('users', {             getUsers: 'list',             deleteUser: 'delete',             updateUser: 'update',             activateUser: 'activate',         }),          ...mapActions('groups', {             getAllUsers: 'listAll',         }),          ...          async someMethod() {             await this.activateUser({ urlParameters: { id: 'USER-007' } });             ...         }     }, }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c.<br \/>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043f\u043e\u043a\u0443\u043f\u043a\u0430\u043c\u0438, \u0441\u043e\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u044b\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">ResourceFactory(     store,     {         name: 'userOrders',         endpoint: 'users\/:userId\/orders',     }, );<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">{     ...      methods: {         ...mapActions('userOrders', {             getOrder: 'get',         }),          async someMethod() {             const order = await this.getOrder({                  urlParameters: {                      userId: 'USER-007',                     id: 'ORDER-001',                 }              });              console.log(order);         }     } }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"chto-mozhno-uluchshit\">\u0427\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0435\u0441\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u2014 \u044d\u0442\u043e \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u0442\u043e\u0440\u0430. \u0412\u0442\u043e\u0440\u043e\u0435 \u2014 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0441\u0442\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f. \u0422\u0440\u0435\u0442\u044c\u0435 \u2014 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043c\u043e\u043a\u043e\u0432 (mocks), \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0433\u043e\u0442\u043e\u0432\u0430 \u0431\u0435\u043a\u0435\u043d\u0434\u043e\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c.<br \/>  \u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435, \u0442\u043e \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u2014 \u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u0438\u0448\u0443 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u044d\u0442\u0438 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"vyvody\">\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434, \u0441\u043b\u0435\u0434\u0443\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 DRY, \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u043c. \u042d\u0442\u043e, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u043d\u0432\u0435\u043d\u0446\u0438\u044f\u043c \u043f\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e API \u0432 \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435 \u0432\u0441\u0435\u043c \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 \u043c\u0435\u0442\u043e\u0434 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a <code>Content-Range<\/code>, \u0443 \u0432\u0430\u0441 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c <a href=\"https:\/\/jsonapi.org\/format\/#fetching-pagination\">\u0434\u0440\u0443\u0433\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/a>. <\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0432 \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u0442\u0430\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432\u044b\u0445 (\u0433\u0435\u043d\u0435\u0440\u0438\u0447\u043d\u044b\u0445) \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u043c\u044b \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0437\u0431\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0439\u0441\u044f \u043a\u043e\u0434 \u0438, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u0438 \u0432\u0440\u0435\u043c\u044f \u0438 \u043d\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0438 \u043d\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u043e\u0432. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043e\u0434\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435 \u0432 \u043a\u043e\u0434\u0435, \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u043e\u0441\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0431\u0430\u0433\u043e\u0432. <\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u0434\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u044f \u0441 \u0440\u0430\u0434\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u0432\u0435\u0447\u0443 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/odin_ingram_micro\/blog\/526094\/\"> https:\/\/habr.com\/ru\/company\/odin_ingram_micro\/blog\/526094\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p>Vuex \u2014 \u044d\u0442\u043e \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u0430\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 Vue.js.<\/p>\n<p>  <\/p>\n<p>Vuex \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0443\u0436\u0438\u0442 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e \u043c\u0435\u0440\u0435 \u0440\u043e\u0441\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0440\u0430\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u044b \u0432 \u043e\u0434\u0438\u043d \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442. <\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432\u043e Vuex \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0442 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043d\u0430 <a href=\"https:\/\/vuex.vuejs.org\/ru\/guide\/modules.html\">\u043c\u043e\u0434\u0443\u043b\u0438<\/a>. \u041a\u0430\u0436\u0434\u044b\u0439 \u0442\u0430\u043a\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u043c\u0443\u0442\u0430\u0446\u0438\u0438, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u0438.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u044f \u043d\u0430\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c CloudBlue Connect \u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u043c\u044b \u043f\u043e\u0439\u043c\u0430\u043b\u0438 \u0441\u0435\u0431\u044f \u043d\u0430 \u043c\u044b\u0441\u043b\u0438, \u0447\u0442\u043e \u043f\u0438\u0448\u0435\u043c \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u043d\u043e\u0432\u0430 \u0438 \u0441\u043d\u043e\u0432\u0430, \u043c\u0435\u043d\u044f\u044f \u043b\u0438\u0448\u044c \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u0435\u043a\u0435\u043d\u0434\u043e\u043c;<\/li>\n<li>\u041c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f Vuex, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u043c;<\/li>\n<li>\u042e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u0432 \u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043e\u0434\u043d\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435 \u0438\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430\u043c\u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438. \u0418 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043c\u044b \u043b\u044e\u0431\u0438\u043c \u0432\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u041f\u043e\u043c\u0438\u043c\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u0432 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u0435 \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443, \u044d\u0442\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0431\u0430\u0433\u043e\u0432 \u0432 \u043a\u043e\u0434\u0435. <\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u0442\u0438\u043f\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 Vuex, \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0432\u0448\u0443\u044e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043e \u043d\u0443\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u0435\u043a\u0435\u043d\u0434\u043e\u043c \u0438 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c (\u0441\u0442\u043e\u0440\u043e\u043c).<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-312436","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/312436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=312436"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/312436\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=312436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=312436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=312436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}