guild_front/src/redux/outstaffingSlice.js

121 lines
3.4 KiB
JavaScript
Raw Normal View History

2023-07-14 03:03:33 +03:00
import {createAsyncThunk, createSlice} from "@reduxjs/toolkit";
2021-06-30 17:21:55 +03:00
const initialState = {
tags: [],
profiles: [],
2023-05-31 08:36:15 +03:00
filteredCandidates: null,
2021-06-30 17:21:55 +03:00
selectedItems: [],
2021-07-02 16:02:47 +03:00
currentCandidate: {},
2021-08-04 13:04:05 +03:00
auth: false,
2021-08-17 12:38:12 +03:00
positionId: null,
2022-12-26 15:12:01 +03:00
profileInfo: {},
2023-05-31 08:36:15 +03:00
reportsDates: "",
2023-04-18 13:58:36 +03:00
partnerEmployees: [],
partnerRequestId: null,
2023-04-21 01:07:09 +03:00
partnerRequests: [],
2023-05-31 08:36:15 +03:00
partnerRequestInfo: {},
2023-07-14 03:03:33 +03:00
notification: {
show: false,
text: '',
type: ''
}
2021-06-30 17:21:55 +03:00
};
export const outstaffingSlice = createSlice({
2023-05-31 08:36:15 +03:00
name: "outstaffing",
2021-06-30 17:21:55 +03:00
initialState,
reducers: {
tags: (state, action) => {
state.tags = action.payload;
},
profiles: (state, action) => {
state.profiles = action.payload;
},
2021-07-03 17:37:30 +03:00
filteredCandidates: (state, action) => {
state.filteredCandidates = action.payload;
},
2021-07-01 14:25:17 +03:00
selectedItems: (state, action) => {
state.selectedItems = action.payload;
2021-06-30 17:21:55 +03:00
},
2021-07-02 16:02:47 +03:00
currentCandidate: (state, action) => {
state.currentCandidate = action.payload;
},
auth: (state, action) => {
state.auth = action.payload;
},
2021-08-17 12:38:12 +03:00
setPositionId: (state, action) => {
state.positionId = action.payload;
},
2022-02-11 15:34:31 +02:00
setUserInfo: (state, action) => {
state.userInfo = action.payload;
2022-12-26 15:12:01 +03:00
},
setProfileInfo: (state, action) => {
state.profileInfo = action.payload;
},
setReportsDates: (state, action) => {
state.reportsDates = action.payload;
},
2023-03-23 14:00:34 +03:00
setPartnerEmployees: (state, action) => {
2023-05-31 08:36:15 +03:00
state.partnerEmployees = action.payload;
2023-04-18 13:58:36 +03:00
},
setPartnerRequestId: (state, action) => {
2023-05-31 08:36:15 +03:00
state.partnerRequestId = action.payload;
2023-04-18 13:58:36 +03:00
},
setPartnerRequests: (state, action) => {
2023-05-31 08:36:15 +03:00
state.partnerRequests = action.payload;
2023-04-21 01:07:09 +03:00
},
setPartnerRequestInfo: (state, action) => {
2023-05-31 08:36:15 +03:00
state.partnerRequestInfo = action.payload;
},
2023-07-14 03:03:33 +03:00
setNotification: (state, action) => {
state.notification = action.payload
},
closeNotification: (state) => {
state.notification.show = false
}
2021-06-30 17:21:55 +03:00
},
});
2023-05-31 08:36:15 +03:00
export const {
tags,
profiles,
selectedItems,
auth,
currentCandidate,
filteredCandidates,
setPositionId,
setUserInfo,
setProfileInfo,
setReportsDates,
setPartnerEmployees,
setPartnerRequestId,
setPartnerRequests,
setPartnerRequestInfo,
2023-07-14 03:03:33 +03:00
setNotification,
closeNotification
2023-05-31 08:36:15 +03:00
} = outstaffingSlice.actions;
2021-06-30 17:21:55 +03:00
export const selectProfiles = (state) => state.outstaffing.profiles;
export const selectTags = (state) => state.outstaffing.tags;
2023-05-31 08:36:15 +03:00
export const selectFilteredCandidates = (state) =>
state.outstaffing.filteredCandidates;
2023-07-14 03:03:33 +03:00
export const getNotification = (state) =>
state.outstaffing.notification
2021-06-30 17:21:55 +03:00
export const selectItems = (state) => state.outstaffing.selectedItems;
2023-05-31 08:36:15 +03:00
export const selectCurrentCandidate = (state) =>
state.outstaffing.currentCandidate;
2021-07-02 16:02:47 +03:00
export const selectAuth = (state) => state.outstaffing.auth;
2021-08-17 12:38:12 +03:00
export const getPositionId = (state) => state.outstaffing.positionId;
2022-12-26 15:12:01 +03:00
export const getProfileInfo = (state) => state.outstaffing.profileInfo;
2023-05-31 08:36:15 +03:00
export const getPartnerRequestInfo = (state) =>
state.outstaffing.partnerRequestInfo;
2022-02-11 15:34:31 +02:00
export const selectUserInfo = (state) => state.outstaffing.userInfo;
2022-12-26 15:12:01 +03:00
export const getReportsDates = (state) => state.outstaffing.reportsDates;
2023-05-31 08:36:15 +03:00
export const getPartnerEmployees = (state) =>
state.outstaffing.partnerEmployees;
export const getPartnerRequestId = (state) =>
state.outstaffing.partnerRequestId;
2023-04-18 13:58:36 +03:00
export const getPartnerRequests = (state) => state.outstaffing.partnerRequests;
2021-06-30 17:21:55 +03:00
export default outstaffingSlice.reducer;