modified left side view - embedded logout procedure

parent fd7da3f8
import { LOGININFO_SAVE } from '../constants';
import { LOGININFO_SAVE, LOGININFO_INIT } from '../constants';
import { Injectable } from '@angular/core';
import { NgRedux } from 'ng2-redux';
import { IAppState } from '../store';
......@@ -19,4 +19,12 @@ export class LoginInfoActions {
});
};
initLoginInfo = () => {
return this._ngRedux.dispatch({
type: LOGININFO_INIT,
payload: {
}
});
};
}
import { REGIONSCHOOLS_RECEIVED, REGIONSCHOOLS_SELECTED_SAVE, REGIONSCHOOLS_ORDER_SAVE } from '../constants';
import { REGIONSCHOOLS_RECEIVED, REGIONSCHOOLS_SELECTED_SAVE, REGIONSCHOOLS_ORDER_SAVE, REGIONSCHOOLS_INIT } from '../constants';
import { Injectable } from '@angular/core';
import { NgRedux } from 'ng2-redux';
import { IAppState } from '../store';
......@@ -25,6 +25,14 @@ export class RegionSchoolsActions {
}
};
initRegionSchools = () => {
return this._ngRedux.dispatch({
type: REGIONSCHOOLS_INIT,
payload: {
}
});
};
/*
getRegionSchools_Reload = (courseActive) => {
const { regions } = this._ngRedux.getState();
......
import { SECTORCOURSES_RECEIVED, SECTORCOURSES_SELECTED_SAVE } from '../constants';
import { SECTORCOURSES_RECEIVED, SECTORCOURSES_SELECTED_SAVE, SECTORCOURSES_INIT } from '../constants';
import { Injectable } from '@angular/core';
import { NgRedux } from 'ng2-redux';
import { IAppState } from '../store';
......@@ -25,6 +25,14 @@ export class SectorCoursesActions {
}
};
initSectorCourses = () => {
return this._ngRedux.dispatch({
type: SECTORCOURSES_INIT,
payload: {
}
});
};
/*
getSectorCourses_Reload = () => {
const { sectors } = this._ngRedux.getState();
......
import { SECTORFIELDS_RECEIVED, SECTORFIELDS_SELECTED_SAVE } from '../constants';
import { SECTORFIELDS_RECEIVED, SECTORFIELDS_SELECTED_SAVE, SECTORFIELDS_INIT } from '../constants';
import { Injectable } from '@angular/core';
import { NgRedux } from 'ng2-redux';
import { IAppState } from '../store';
......@@ -6,32 +6,41 @@ import { HelperDataService } from '../services/helper-data-service';
@Injectable()
export class SectorFieldsActions {
constructor(
private _ngRedux: NgRedux<IAppState>,
private _hds: HelperDataService) {}
constructor(
private _ngRedux: NgRedux<IAppState>,
private _hds: HelperDataService) { }
getSectorFields = (reload) => {
const { sectorFields } = this._ngRedux.getState();
//if (sectorFields.size === 0) {
if (reload === true || (reload === false && sectorFields.size === 0)) {
return this._hds.getSectorFields().then(sectorFields => {
return this._ngRedux.dispatch({
type: SECTORFIELDS_RECEIVED,
payload: {
sectorFields
}
getSectorFields = (reload) => {
const { sectorFields } = this._ngRedux.getState();
//if (sectorFields.size === 0) {
if (reload === true || (reload === false && sectorFields.size === 0)) {
return this._hds.getSectorFields().then(sectorFields => {
return this._ngRedux.dispatch({
type: SECTORFIELDS_RECEIVED,
payload: {
sectorFields
}
});
});
}
};
initSectorFields = () => {
return this._ngRedux.dispatch({
type: SECTORFIELDS_INIT,
payload: {
}
});
}
};
};
saveSectorFieldsSelected = (sectorFieldsSelected) => {
return this._ngRedux.dispatch({
type: SECTORFIELDS_SELECTED_SAVE,
payload: {
sectorFieldsSelected
}
});
};
saveSectorFieldsSelected = (sectorFieldsSelected) => {
return this._ngRedux.dispatch({
type: SECTORFIELDS_SELECTED_SAVE,
payload: {
sectorFieldsSelected
}
});
};
}
export const API_ENDPOINT = 'http://eepal.dev/drupal';
export class AppSettings {
public static get API_ENDPOINT(): string {
// return 'http://localhost/drupal-8.2.5';
// return 'http://localhost/angular/eepal-front/drupal';
......
......@@ -11,15 +11,17 @@ import {
FormControl,
FormArray
} from '@angular/forms';
import { AppSettings } from '../app.settings';
import { API_ENDPOINT } from '../app.settings';
@Component({
selector: 'home',
template: `
<div>
<form [formGroup]="formGroup" method = "POST" action="http://eepal.dev/drupal/oauth/login" #form>
<form [formGroup]="formGroup" method = "POST" action="{{apiEndPoint}}/oauth/login" #form>
<!-- <input type="hidden" name="X-oauth-enabled" value="true"> -->
<div *ngFor="let loginInfoToken$ of loginInfo$ | async; let i=index">
<div class="row">
<div *ngFor="let loginInfoToken$ of loginInfo$ | async; let i=index"></div>
<!-- <div class="row">
<div class="col-md-6">
{{loginInfoToken$.auth_token}}
</div>
......@@ -27,15 +29,16 @@ import { AppSettings } from '../app.settings';
{{loginInfoToken$.auth_role}}
</div>
</div>
</div>
<div class="row">
</div> -->
<div class="row" style="min-height: 300px; margin-top: 100px;">
<div *ngIf="!authToken" class="col-md-7 col-md-offset-5">
<button type="submit" class="btn-primary btn-lg pull-center" (click)="form.submit()">
<div *ngIf="!authToken" class="col-md-8 offset-md-4">
<button type="submit" class="btn-primary btn-lg" (click)="form.submit()">
Είσοδος μέσω TaxisNet<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
</div>
<!--
<div class="row">
<div *ngIf="authToken" class="col-md-7 col-md-offset-5">
<h3>Καλώς ήρθατε</h3>
......@@ -49,6 +52,7 @@ import { AppSettings } from '../app.settings';
</button>
</div>
</div>
-->
</form>
</div>
`
......@@ -58,16 +62,19 @@ export default class Home implements OnInit {
private authToken: string;
private authRole: string;
private loginInfo$: Observable<ILoginInfo>;
private apiEndPoint = API_ENDPOINT;
constructor(private fb: FormBuilder,
private _ata: LoginInfoActions,
private _ngRedux: NgRedux<IAppState>,
private activatedRoute: ActivatedRoute
private activatedRoute: ActivatedRoute,
private router: Router
) {
this.authToken = '';
this.authRole = '';
this.formGroup = this.fb.group({
Username: [],
Paswd: []
// Username: [],
// Paswd: []
});
};
......@@ -77,16 +84,21 @@ export default class Home implements OnInit {
state.loginInfo.reduce(({}, loginInfoToken) => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
if (this.authToken && this.authToken.length > 0)
this.router.navigate(['/epal-class-select']);
return loginInfoToken;
}, {});
}
return state.loginInfo;
});
// subscribe to router event
this.activatedRoute.queryParams.subscribe((params: Params) => {
this.authToken = params['auth_token'];
this.authRole = params['auth_role'];
if (params) {
this.authToken = params['auth_token'];
this.authRole = params['auth_role'];
}
if (this.authToken && this.authRole)
this._ata.saveLoginInfo({ auth_token: this.authToken, auth_role: this.authRole });
// console.log(this.authToken);
......
......@@ -8,8 +8,15 @@
<img src="../myschool/assets/images/myschool_logo.png" alt="Αρχική" />
</a>
<div class="collapse navbar-collapse flex-row-reverse" id="navbarNav">
<div *ngFor="let loginInfoToken$ of loginInfo$ | async; let i=index"></div>
<ul class="navbar-nav">
<b>Όνομα Χρήστη:</b> {{this.cuser}}
&nbsp;&nbsp;
<div *ngIf="authToken">
<button type="button" class="btn-primary btn-sm pull-right" (click)="oauthSignOut()">
<i class="fa fa-sign-out"></i>
</button>
</div>
<!--
<li class="nav-item" [ngClass]="{active: path=='application-preview'}">
......
import {Component, OnInit} from '@angular/core';
import {Router} from '@angular/router';
import { Injectable } from "@angular/core";
import { HelperDataService } from '../../services/helper-data-service';
import { Observable } from 'rxjs/Rx';
import { LoginInfoActions } from '../../actions/logininfo.actions';
import { ILoginInfo } from '../../store/logininfo/logininfo.types';
import { NgRedux, select } from 'ng2-redux';
import { IAppState } from '../../store/store';
@Component({
selector: 'reg-navbar',
......@@ -8,22 +14,46 @@ import { HelperDataService } from '../../services/helper-data-service';
})
@Injectable() export default class NavbarComponent implements OnInit{
private authToken: string;
private authRole: string;
private loginInfo$: Observable<ILoginInfo>;
public cuser :any;
public cuser :any;
constructor( private _ata: LoginInfoActions,
private _hds: HelperDataService,
private _ngRedux: NgRedux<IAppState>,
private router: Router
) {
this.authToken = '';
this.authRole = '';
constructor( private _hds: HelperDataService) {
};
ngOnInit() {
this.loginInfo$ = this._ngRedux.select(state => {
if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({}, loginInfoToken) => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
return loginInfoToken;
}, {});
}
return state.loginInfo;
});
this._hds.getCurrentUser().then( cuser => this.cuser= cuser );
}
oauthSignOut() {
this._hds.signOut().then(data => {
this._ata.initLoginInfo();
this.authToken = '';
this.authRole = '';
this.router.navigate(['/']);
});
}
......
......@@ -22,8 +22,8 @@ import {AppSettings} from '../../app.settings';
@Component({
selector: 'application-preview-select',
template: `
<div *ngFor="let epalclass$ of epalclasses$ | async;">
<h4 style="margin-top: 20px; line-height: 2em; ">Οι επιλογές μου</h4>
<div class="row">
<div class="btn-group inline pull-center">
<button type="button" class="btn-primary btn-md pull-center" (click)="defineClass()">
......@@ -32,54 +32,55 @@ import {AppSettings} from '../../app.settings';
</div>
</div>
<ul class="list-group" style="margin-bottom: 20px;">
<div *ngFor="let epalclass$ of epalclasses$ | async;">
<li class="list-group-item">
Τάξη εισαγωγής: {{epalclass$.name }}
</li>
</div>
</ul>
</div>
<div *ngFor="let sector$ of sectors$ | async;">
<div *ngFor="let sectorField$ of sectorFields$ | async;">
<div class="row">
<div class="btn-group inline pull-center">
<button type="button" class="btn-primary btn-md pull-center" (click)="defineSector()" [hidden] = "classSelected === 1" [disabled] = "classSelected === 3">
<button type="button" class="btn-primary btn-md pull-center" [hidden] = "classSelected === 1" [disabled] = "classSelected === 3">
O τομέας μου<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
</div>
<ul class="list-group" style="margin-bottom: 20px;">
<div *ngFor="let sectorField$ of sectorFields$ | async;">
<li class="list-group-item" *ngIf="sectorField$.selected === true" >
{{sectorField$.name }}
</li>
</div>
<div *ngFor="let sector$ of sectors$ | async;">
<li class="list-group-item" *ngIf="sector$.sector_selected === true" >
{{sector$.sector_name }}
</li>
</div>
</ul>
</div>
<div *ngFor="let course$ of sector$.courses;" >
<div class="row">
<div class="btn-group inline pull-center">
<button type="button" class="btn-primary btn-md pull-center" (click)="defineCourse()" [hidden] = "classSelected !== 3">
<button type="button" class="btn-primary btn-md pull-center" [hidden] = "classSelected !== 3">
Η ειδικότητά μου<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
</div>
<ul class="list-group" style="margin-bottom: 20px;">
<div *ngFor="let sector$ of sectors$ | async;">
<div *ngFor="let course$ of sector$.courses;" >
<li class="list-group-item" *ngIf="course$.selected === true">
{{course$.course_name }}
</li>
</div>
</div>
</ul>
</div>
</div>
<div *ngIf="regions$.size > 0 | async">
<div class="row">
<div class="btn-group inline pull-center">
<button type="button" id = "butsch" class="btn-primary btn-md pull-center" (click)="defineSchools()" [disabled] = "numSelectedSchools === 0 ">
<button type="button" id = "butsch" class="btn-primary btn-md pull-center" [disabled] = "numSelectedSchools === 0 ">
Τα σχολεία μου<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
......@@ -93,18 +94,11 @@ import {AppSettings} from '../../app.settings';
<li class="list-group-item" *ngIf="epal$.selected === true && epal$.order_id === 0">
{{epal$.epal_name }}
</li>
</div>
</div>
<div *ngFor="let region$ of regions$ | async;">
<div *ngFor="let epal$ of region$.epals; " >
<li class="list-group-item" *ngIf="epal$.selected === true && epal$.order_id === 2">
Προτίμηση {{epal$.order_id}}: {{epal$.epal_name }}
</li>
</div>
</div>
<div *ngFor="let region$ of regions$ | async;">
<div *ngFor="let epal$ of region$.epals; " >
<li class="list-group-item" *ngIf="epal$.selected === true && epal$.order_id === 3">
Προτίμηση {{epal$.order_id}}: {{epal$.epal_name }}
</li>
......@@ -115,10 +109,12 @@ import {AppSettings} from '../../app.settings';
[hidden] = "numSelectedSchools <= 1 ">> Σειρά προτίμησης</button>
</div>
</ul>
</div>
<div *ngIf="studentDataFields$.size > 0 | async">
<div class="row">
<div class="btn-group inline pull-center">
<button type="button" class="btn-primary btn-md pull-center" (click)="definePersonalData()"
<button type="button" class="btn-primary btn-md pull-center"
[disabled] = "numSelectedOrder === 0">
Τα στοιχεία μου<span class="glyphicon glyphicon-menu-right"></span>
</button>
......@@ -133,12 +129,13 @@ import {AppSettings} from '../../app.settings';
Επώνυμο μαθητή: {{studentDataField$.studentsurname }}
</li>
</div>
<div *ngFor="let selectedAmkaFill$ of selectedAmkaFills$ | async;">
<!-- <div *ngFor="let selectedAmkaFill$ of selectedAmkaFills$ | async;">
<li class="list-group-item">
AMKA μαθητή: {{selectedAmkaFill$.name}}
</li>
</div>
</div> -->
</ul>
</div>
`
})
......
......@@ -23,7 +23,7 @@ import {AppSettings} from '../../app.settings';
<form [formGroup]="formGroup">
<div *ngFor="let epalclass$ of epalclasses$ | async;"> </div>
<div class="form-group">
<div class="form-group" style= "margin-top: 50px; margin-bottom: 100px;">
<label for="name">Παρακαλώ επιλέξτε την τάξη εισαγωγής του μαθητή στην Επαγγελματική Εκπαίδευση</label><br/>
<select class="form-control" formControlName="name" (change)="initializestore()">
<option value="Α' Λυκείου">Α' Λυκείου</option>
......@@ -103,9 +103,12 @@ import {AppSettings} from '../../app.settings';
initializestore()
{
this._cfa.saveEpalClassesSelected(this.formGroup.value);
this._sfa.getSectorFields(true);
this._sfa.initSectorFields();
this._rsa.initRegionSchools();
this._csa.initSectorCourses();
/* this._sfa.getSectorFields(true);
this._rsa.getRegionSchools(1,"-1", true);
this._csa.getSectorCourses(true);
this._csa.getSectorCourses(true); */
}
......
......@@ -34,23 +34,23 @@ import {AppSettings} from '../../app.settings';
<li class="list-group-item" (click)="setActiveRegion(i)" [style.background-color]="toggleBackgroundColor(i)">
<h5>{{region$.region_name}}</h5>
</li>
<div *ngFor="let epal$ of region$.epals; let j=index;" [hidden]="i !== regionActive">
<div class="row">
<div class="col-md-2 col-md-offset-1">
<div class="col-md-2 col-md-offset-1">
<input #cb type="checkbox" formControlName="{{ epal$.globalIndex }}"
(change)="saveSelected(cb,j)"
[hidden] = "numSelected === 3 && cb.checked === false"
>
</div>
</div>
<div class="col-md-8 col-md-offset-1">
{{epal$.epal_name | removeSpaces}}
</div>
</div>
</div>
</div>
</ul>
</div>
......@@ -88,11 +88,11 @@ import {AppSettings} from '../../app.settings';
private _ngRedux: NgRedux<IAppState>,
private router: Router,
private loaderService: LoaderService
) {
this.formGroup = this.fb.group({
formArray: this.rss
});
this.objLoaderStatus=false;
......@@ -100,7 +100,7 @@ import {AppSettings} from '../../app.settings';
};
ngOnInit() {
this.loaderService.loaderStatus.subscribe((val: boolean) => {
this.objLoaderStatus = val;
});
......@@ -162,10 +162,10 @@ import {AppSettings} from '../../app.settings';
saveSelected(cb,j) {
this._rsa.saveRegionSchoolsSelected(this.formGroup.value.formArray);
//σε κάθε νέο check, αρχικοποίησε τη σειρά προτιμήσεων (σειρά προτίμησης:0)
let schoolArrayOrders: Array<number> = new Array();
/* let schoolArrayOrders: Array<number> = new Array();
for (let i=0; i < this.formGroup.value.formArray.length; i++)
schoolArrayOrders.push(0);
this._rsa.saveRegionSchoolsOrder(schoolArrayOrders);
this._rsa.saveRegionSchoolsOrder(schoolArrayOrders); */
}
navigateToApplication() {
......
......@@ -3,13 +3,16 @@ export const COURSEFIELDS_SELECTED_SAVE = 'COURSEFIELDS_SELECTED_SAVE';
export const SECTORFIELDS_RECEIVED = 'SECTORFIELDS_RECEIVED';
export const SECTORFIELDS_SELECTED_SAVE = 'SECTORFIELDS_SELECTED_SAVE';
export const SECTORFIELDS_INIT = 'SECTORFIELDS_INIT';
export const REGIONSCHOOLS_RECEIVED = 'REGIONSCHOOLS_RECEIVED';
export const REGIONSCHOOLS_SELECTED_SAVE = 'REGIONSCHOOLS_SELECTED_SAVE';
export const REGIONSCHOOLS_ORDER_SAVE = 'REGIONSCHOOLS_ORDER_SAVE';
export const REGIONSCHOOLS_INIT = 'REGIONSCHOOLS_INIT';
export const SECTORCOURSES_RECEIVED = 'SECTORCOURSES_RECEIVED';
export const SECTORCOURSES_SELECTED_SAVE = 'SECTORCOURSES_SELECTED_SAVE';
export const SECTORCOURSES_INIT = 'SECTORCOURSES_INIT';
export const STUDENTDATAFIELDS_RECEIVED = 'STUDENTDATAFIELDS_RECEIVED';
export const STUDENTDATAFIELDS_SAVE = 'STUDENTDATAFIELDS_SAVE';
......@@ -18,6 +21,7 @@ export const EPALCLASSES_SAVE = 'EPALCLASSES_SAVE';
export const AMKAFILL_SAVE = 'AMKAFILL_SAVE';
export const LOGININFO_SAVE = 'LOGININFO_SAVE';
export const LOGININFO_INIT = 'LOGININFO_INIT';
export const CRITERIA_SAVE = 'CRITERIA_SAVE';
......
......@@ -38,8 +38,7 @@ export class HelperDataService {
};
createAuthorizationHeader(headers: Headers) {
headers.append('Authorization', 'Basic ' +
btoa(this.authToken + ':' + this.authToken));
headers.append('Authorization', 'Basic ' + btoa(this.authToken + ':' + this.authToken));
}
getCourseFields() {
......@@ -247,8 +246,40 @@ export class HelperDataService {
});
};
signOut() {
this.loginInfo$.forEach(loginInfoToken => {
console.log(loginInfoToken.get(0));
this.authToken = loginInfoToken.get(0).auth_token;
});
let headers = new Headers({
//"Authorization": "Basic cmVzdHVzZXI6czNjckV0MFAwdWwwJA==", // encoded user:pass
// "Authorization": "Basic bmthdHNhb3Vub3M6emVtcmFpbWU=",
"Content-Type": "application/json",
"Accept": "*/*",
"Access-Control-Allow-Credentials": "true",
// "Content-Type": "text/plain", // try to skip preflight
//"X-CSRF-Token": "hVtACDJjFRSyE4bgGJENHbXY0B9yNhF71Fw-cYHSDNY"
//"X-CSRF-Token": "fj1QtF_Z_p6kE19EdCnN08zoSjVfcT4Up-ciW6I0IG8"
"X-CSRF-Token": "EoAZ0APpIbbewK5MNzRrCFkvEeZZoGQsBslWFTrZ8bI",
// "X-oauth-enabled": "true",
// "X-Auth-Token": this.authToken
});
this.createAuthorizationHeader(headers);
let options = new RequestOptions({ headers: headers, withCredentials: true });
return new Promise((resolve, reject) => {
this.http.post(`${AppSettings.API_ENDPOINT}/oauth/logout`, {}, options)
.map(response => response)
.subscribe(data => {
resolve(data);
console.log(data);
}, // put the data returned from the server in our variable
error => {
console.log("Error Logout"); // in case of failure show this message
reject("Error Logout");
},
() => console.log("Logging out"));//run this code in all cases); */
});
}
}
......@@ -3,7 +3,8 @@ import { INITIAL_STATE } from './logininfo.initial-state';
import { Seq } from 'immutable';
import {
LOGININFO_SAVE
LOGININFO_SAVE,
LOGININFO_INIT
} from '../../constants';
export function loginInfoReducer(state: ILoginInfo = INITIAL_STATE, action): ILoginInfo {
......@@ -12,6 +13,8 @@ export function loginInfoReducer(state: ILoginInfo = INITIAL_STATE, action): ILo
let loginInfoTokens = Array<ILoginInfoToken>();
loginInfoTokens.push(<ILoginInfoToken>{auth_token: action.payload.loginInfo.auth_token, auth_role: action.payload.loginInfo.auth_role});
return Seq(loginInfoTokens).map(n => n).toList();
case LOGININFO_INIT:
return INITIAL_STATE;
default:
return state;
}
......
......@@ -5,7 +5,8 @@ import { Seq } from 'immutable';
import {
REGIONSCHOOLS_RECEIVED,
REGIONSCHOOLS_SELECTED_SAVE,
REGIONSCHOOLS_ORDER_SAVE
REGIONSCHOOLS_ORDER_SAVE,
REGIONSCHOOLS_INIT
} from '../../constants';
export function regionSchoolsReducer(state: IRegions = INITIAL_STATE, action): IRegions {
......@@ -27,7 +28,7 @@ export function regionSchoolsReducer(state: IRegions = INITIAL_STATE, action): I
state.forEach(region => {
regionsWithSelections.push(<IRegion>{region_id: region.region_id, region_name: region.region_name, epals: Array<IRegionSchool>()});
region.epals.forEach(epal => {
regionsWithSelections[ind].epals.push(<IRegionSchool>{epal_id: epal.epal_id, epal_name: epal.epal_name, globalIndex: epal.globalIndex, selected: action.payload.regionSchoolsSelected[j], order_id: epal.order_id});
regionsWithSelections[ind].epals.push(<IRegionSchool>{epal_id: epal.epal_id, epal_name: epal.epal_name, globalIndex: epal.globalIndex, selected: action.payload.regionSchoolsSelected[j], order_id: 0});
j++;
})
ind++;
......@@ -47,6 +48,8 @@ export function regionSchoolsReducer(state: IRegions = INITIAL_STATE, action): I
});
return Seq(regionsWithOrders).map(n => n).toList();
case REGIONSCHOOLS_INIT:
return INITIAL_STATE;
default: return state;
}
};
......@@ -4,7 +4,8 @@ import { Seq } from 'immutable';
import {
SECTORCOURSES_RECEIVED,
SECTORCOURSES_SELECTED_SAVE
SECTORCOURSES_SELECTED_SAVE,
SECTORCOURSES_INIT
} from '../../constants';
export function sectorCoursesReducer(state: ISectors = INITIAL_STATE, action): ISectors {
......@@ -33,6 +34,8 @@ export function sectorCoursesReducer(state: ISectors = INITIAL_STATE, action): I
ind++;
});
return Seq(sectorsWithSelections).map(n => n).toList();
case SECTORCOURSES_INIT:
return INITIAL_STATE;
default: return state;
}
};
......@@ -4,7 +4,8 @@ import { Seq } from 'immutable';
import {
SECTORFIELDS_RECEIVED,
SECTORFIELDS_SELECTED_SAVE
SECTORFIELDS_SELECTED_SAVE,
SECTORFIELDS_INIT
} from '../../constants';
export function sectorFieldsReducer(state: ISectorFields = INITIAL_STATE, action): ISectorFields {
......@@ -25,6 +26,8 @@ export function sectorFieldsReducer(state: ISectorFields = INITIAL_STATE, action
ind++;
});
return Seq(selectedSectorFields).map(n => n).toList();
case SECTORFIELDS_INIT:
return INITIAL_STATE;
default: return state;
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment