UNPKG

@rtbjs/use-state

Version:

`@rtbjs/use-state` is a state management tool that can act as a local state and be easily turned into a global redux state. It is an innovative approach to state management that combines the advantages of both React's useState and Redux's state management

53 lines 2.2 kB
"use strict"; exports.__esModule = true; exports.useDeleteProjectMutation = exports.useUpdateProjectMutation = exports.useGetAllProjectsQuery = exports.useCreateProjectMutation = exports.projectApi = void 0; var main_api_1 = require("./main-api"); exports.projectApi = main_api_1.mainApi.injectEndpoints({ endpoints: function (builder) { return ({ createProject: builder.mutation({ query: function (project) { return { url: '/projects', method: 'POST', credentials: 'same-origin', body: project }; }, invalidatesTags: [{ type: 'Projects' }] }), getAllProjects: builder.query({ query: function () { return { url: "/projects", credentials: 'same-origin' }; }, providesTags: [{ type: 'Projects' }], transformResponse: function (results) { return results.projects; } }), updateProject: builder.mutation({ query: function (_a) { var id = _a.id, project = _a.project; return { url: "/projects/".concat(id), method: 'PATCH', credentials: 'same-origin', body: project }; }, invalidatesTags: [{ type: 'Projects' }] }), deleteProject: builder.mutation({ query: function (id) { return { url: "/projects/".concat(id), method: 'Delete', credentials: 'same-origin' }; }, invalidatesTags: [{ type: 'Projects' }] }) }); } }); exports.useCreateProjectMutation = exports.projectApi.useCreateProjectMutation, exports.useGetAllProjectsQuery = exports.projectApi.useGetAllProjectsQuery, exports.useUpdateProjectMutation = exports.projectApi.useUpdateProjectMutation, exports.useDeleteProjectMutation = exports.projectApi.useDeleteProjectMutation; //# sourceMappingURL=project-api.js.map