Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions codeidaca_client/src/Routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import Location from './views/app/setting/MasterLocation/indexLocation'
import Category from './views/app/setting/MasterCategory/indexCategory'
import Module from './views/app/setting/MasterModule/indexModule'
import Skill from './views/app/setting/MasterSkill/indexSkill'
import BatchEva from './views/app/batch/BatchStudentEvaluation';



Expand Down Expand Up @@ -57,6 +58,7 @@ export default function Routes(isLoggedIn) {
{ path: 'dashboard', element: isLoggedIn ? <Dashboard/> : <Navigate to="/auth/signin"/>},
{ path: 'candidat', element: isLoggedIn ? <Candidat/>: <Navigate to="/auth/signin"/> },
{ path: 'batch', element: isLoggedIn ? <Batch /> : <Navigate to="/auth/signin"/>},
{ path: 'batch/evaluation/:id', element: <BatchEva/>},
{ path: 'placement', element: isLoggedIn ? <Placement />: <Navigate to="/auth/signin"/> },
{ path: 'talent', element: isLoggedIn ? <Talent />: <Navigate to="/auth/signin"/> },
{ path: 'curriculum', element: isLoggedIn ? <Curriculum />: <Navigate to="/auth/signin"/> },
Expand Down
49 changes: 49 additions & 0 deletions codeidaca_client/src/api/api-bateva.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import axios from "axios";
import config from "../config/config";

const list = async()=> {

try {
const result = await axios.get(`${config.domain}/batch/evaluation/cari/aua`)
return result.data
} catch (error) {
return await error.message
}

}

const create = async(payload)=>{
try {
// for (var pair of payload.entries()) {
// console.log(pair[0]+ ' - ' + pair[1]);
// }
const result = await axios.post(`${config.domain}/batch/evaluation`,payload)
// console.log(result.data)
return result.data
} catch (error) {
return await error.message
}
}

const findOne = async(id)=>{
try {
// const result = await axios.get(`${config.domain}/batch/evaluation/a/${id}`)
const result = await axios.get(`${config.domain}/batch/evaluation/${id}`)
return result.data
} catch (error) {
return error
}
}

const findOne1 = async(id)=>{
try {
const result = await axios.get(`${config.domain}/batch/evaluation/a/${id}`)
return result.data
} catch (error) {
return error
}
}


export default {list,create,findOne,findOne1,}

30 changes: 30 additions & 0 deletions codeidaca_client/src/redux-saga/actions/BatEvaAction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import * as ActionType from "../constants/BatEvaConstant";

export const GetBatEvaRequest = () => ({
type: ActionType.GET_BATEVA_REQUEST,
});

export const GetBatEvaSuccess = (payload) => ({
type: ActionType.GET_BATEVA_SUCCESS,
payload,
});

export const GetBatEvaFailed = (payload) => ({
type: ActionType.GET_BATEVA_FAILED,
payload,
});

export const AddBatEvaRequest = (payload) => ({
type: ActionType.ADD_BATEVA_REQUEST,
payload,
})

export const AddBatEvaSuccess = (payload) => ({
type: ActionType.ADD_BATEVA_SUCCESS,
payload,
})

export const AddBatEvaFailed = (payload) =>({
type : ActionType.ADD_BATEVA_FAILED,
payload,
})
8 changes: 8 additions & 0 deletions codeidaca_client/src/redux-saga/constants/BatEvaConstant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const GET_BATEVA_REQUEST = "evaluation/get/request";
export const GET_BATEVA_SUCCESS = "evaluation/get/success";
export const GET_BATEVA_FAILED = "evaluation/get/failed";

export const ADD_BATEVA_REQUEST = 'evaluation/add/request'
export const ADD_BATEVA_SUCCESS = 'evaluation/add/success'
export const ADD_BATEVA_FAILED = 'evaluation/add/failed'

36 changes: 36 additions & 0 deletions codeidaca_client/src/redux-saga/middleware/BatEvaMiddle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import {
all, call, fork, put, takeEvery, takeLatest,
} from 'redux-saga/effects';
import apiBateva from '../../api/api-bateva';


import {
GetBatEvaSuccess,
GetBatEvaFailed,
AddBatEvaSuccess,
AddBatEvaFailed

} from '../actions/BatEvaAction';

function* handleGetBatEva() {
try {
const result = yield call(apiBateva.findOne);
yield put(GetBatEvaSuccess(result));
} catch (error) {
yield put(GetBatEvaFailed(error));
}
}

function* handleAddBatEva(action){
const { payload } = action;
try {
const result = yield call(apiBateva.create, payload);
yield put(AddBatEvaSuccess(result));
} catch (error) {
yield put(AddBatEvaFailed(error));
}
}



export { handleGetBatEva, handleAddBatEva};
7 changes: 5 additions & 2 deletions codeidaca_client/src/redux-saga/middleware/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as ActionTypeProgramEntity from '../constants/ProgramEntity';
// import * as ActionCountryType from '../constants/Country'
// import * as ActionProvince from '../constants/Province'
import * as ActionMasterLocation from '../constants/MasterLocation'

import * as ActionTypeBatEva from '../constants/BatEvaConstant'

import {handleSignup,handleSignin,handleSignout} from './UserSaga'
import {handleGetFourProgram,handleGetThreeCourse,handleGetAlumniTestimony} from './ProgramEntitySaga'
Expand All @@ -20,7 +20,7 @@ import {
handleAddCity,handleDelCity,handleEditCity,handleGetCity,handleGetOneCity
} from './MasterLocationSaga'


import {handleGetBatEva,handleAddBatEva} from './BatEvaMiddle'
function *watchAll() {
yield all([
takeEvery(ActionTypeUser.ADD_SIGNUP_REQUEST, handleSignup),
Expand Down Expand Up @@ -55,6 +55,9 @@ function *watchAll() {
takeEvery(ActionMasterLocation.ADD_CITY_REQUEST,handleAddCity),
takeEvery(ActionMasterLocation.GETONE_CITY_REQUEST,handleGetOneCity),
takeEvery(ActionMasterLocation.EDIT_CITY_REQUEST,handleEditCity),

takeEvery(ActionTypeBatEva.GET_BATEVA_REQUEST, handleGetBatEva),
takeEvery(ActionTypeBatEva.ADD_BATEVA_REQUEST, handleAddBatEva)
])
}

Expand Down
58 changes: 58 additions & 0 deletions codeidaca_client/src/redux-saga/reducers/BatEvaReducer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import * as ActionType from "../constants/BatEvaConstant";

const INIT_STATE = {
BatEva: [],
status : {}
};

const BatEvaReducer = (state = INIT_STATE, action) => {
switch (action.type) {
case ActionType.GET_BATEVA_REQUEST:
return {
...state,
status:"",
isLoading: true

};

case ActionType.GET_BATEVA_SUCCESS: {
return GetBatEvaSucceed(state,action)
}

case ActionType.ADD_BATEVA_REQUEST: {
return {
...state,
status:"",
// isLoading: true,
// isRefresh: true

};
}

case ActionType.ADD_BATEVA_SUCCESS: {
return AddBatEvaSucceed(state, action);
}


default:
return state;
}
};

const GetBatEvaSucceed = (state, action) => {
return {
...state,
BatEva: action.payload,
};
};

const AddBatEvaSucceed = (state,action) =>{
const hasil = action.payload
return {
...state,
BatEva:hasil,
status: hasil
};
}

export default BatEvaReducer;
4 changes: 3 additions & 1 deletion codeidaca_client/src/redux-saga/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import CountryReduce from './CountryReducer';
import ProvinceReduce from './ProvinceReducer';
import CityReduce from './CityReducer';
import MasterLocationReduce from './MasterLocationReducer';
import BatEvaReducer from './BatEvaReducer';

const rootReducer = combineReducers({
userState : userReducer,
Expand All @@ -14,7 +15,8 @@ const rootReducer = combineReducers({
countryState:CountryReduce,
provinceState:ProvinceReduce,
cityState:CityReduce,
masterLocationState:MasterLocationReduce
masterLocationState:MasterLocationReduce,
BatEvaState : BatEvaReducer
});

export default rootReducer;
Loading