mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
WIP feature/Register
This commit is contained in:
7
client/src/store/registers/register.action.js
Normal file
7
client/src/store/registers/register.action.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import ApiService from 'services/ApiService';
|
||||
|
||||
export const submitRegister = ({ form }) => {
|
||||
return (dispatch) => {
|
||||
return ApiService.post('auth/register', { ...form });
|
||||
};
|
||||
};
|
||||
20
client/src/store/registers/register.reducer.js
Normal file
20
client/src/store/registers/register.reducer.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import t from 'store/types';
|
||||
|
||||
const initialState = {
|
||||
registers: {},
|
||||
};
|
||||
|
||||
export default createReducer(initialState, {
|
||||
[t.REGISTER_SET]: (state, action) => {
|
||||
const _registers = {};
|
||||
|
||||
action.registers.forEach((register) => {
|
||||
_registers[register.id] = register;
|
||||
});
|
||||
state.registers = {
|
||||
...state.registers,
|
||||
..._registers,
|
||||
};
|
||||
},
|
||||
});
|
||||
4
client/src/store/registers/register.type.js
Normal file
4
client/src/store/registers/register.type.js
Normal file
@@ -0,0 +1,4 @@
|
||||
export default {
|
||||
REGISTER_SET: 'REGISTER_SUCCESS',
|
||||
REGISTER_CLEAR_ERRORS: 'REGISTER_CLEAR_ERRORS',
|
||||
};
|
||||
@@ -14,6 +14,7 @@ import financialStatements from './financialStatement/financialStatements.types'
|
||||
import itemCategories from './itemCategories/itemsCategory.type';
|
||||
import settings from './settings/settings.type';
|
||||
import search from './search/search.type';
|
||||
import register from './registers/register.type';
|
||||
|
||||
export default {
|
||||
...authentication,
|
||||
@@ -32,4 +33,5 @@ export default {
|
||||
...settings,
|
||||
...accounting,
|
||||
...search,
|
||||
...register,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user