source: jobvista-frontend/src/redux/actions/adminActions.js

main
Last change on this file was b248810, checked in by 223021 <daniel.ilievski.2@…>, 3 weeks ago

Added no access page for new recruiters and admin panel for granting access

  • Property mode set to 100644
File size: 1.1 KB
Line 
1import axios from "../../axios/axiosInstance";
2import {CHANGE_ACCESS, FETCH_RECRUITERS} from "../actionTypes";
3
4export const AdminActions = {
5 fetchRecruiters: (callback) => {
6 return dispatch => {
7 axios.get("/admin/recruiters")
8 .then(response => {
9 dispatch({
10 type: FETCH_RECRUITERS,
11 recruiters: response.data
12 })
13 callback(true, response)
14 }).catch((error) => {
15 callback(false, error)
16 })
17 }
18 },
19 changeAccess: (recruiterId, access, callback) => {
20 return dispatch => {
21 axios.post("/admin/change-access/" + recruiterId, access, {
22 headers: {
23 'Content-Type': 'application/json'
24 }
25 }).then(response => {
26 dispatch({
27 type: CHANGE_ACCESS,
28 recruiter: response.data
29 })
30 callback(true, response)
31 }).catch((error) => {
32 callback(false, error)
33 })
34 }
35 }
36}
Note: See TracBrowser for help on using the repository browser.