1.1.10 • Published 5 years ago

@stfalcon/vuex-crud-module-creator v1.1.10

Weekly downloads
18
License
MIT
Repository
github
Last release
5 years ago

Stfalcon-vuex-crud-module-creator

If you need to create a lot of crud operation. It's for you. The Simple wrapper on your vuex-modules. Included four basic operations. $create, $read, $update, $remove

Installing

npm i @stfalcon/vuex-crud-module-creator

Usage

Create module

some-module.js

import { createModule } from "@stfalcon/vuex-crud-module-creator";
const module = createModule(
  "todo",
  {
    /* options */
  },
  {
    /* override store */
  }
);

export default module;

Options

{
  endpoint?: string;
  getKey?: () => string | number;
  transportAdapter?: fetch | axios;
  paginationStrategy? "basic" | "pointer";
}
NameTypeDefaultDescription
endpointStringas a module nameURL where you will send requests. For example: "users" or "users/:userId/orders"
getKeyFunction() => "id"By default getKey return id and all your collections saved how a object { [id]: someData }
If you wanna change key you should write your custom reducer
transportAdapteranyfetchYour layer for send requests to a server. We recommend using axios
paginationStartegyObject{ type: "basic" }In to createModule including pagination options. In basic strategy you have next keys:
{ total: number, offset: number, limit: number }

Global configuration

store.js

You can install transportAdapter globally

import { createModule } from "stfalcon-vuex-crud-module-creator";
import axios from "axios";

createModule.configure({
  transportAdapter: axios
});
1.1.10

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago