115 lines
2.0 KiB
TypeScript
115 lines
2.0 KiB
TypeScript
import {
|
|
ReadAllByDomain,
|
|
ReadAllByDomainFailure,
|
|
ReadAllByDomainSuccess,
|
|
Accept,
|
|
AcceptSuccess,
|
|
AcceptFailure,
|
|
Deny,
|
|
DenySuccess,
|
|
DenyFailure,
|
|
ActionType,
|
|
Actions,
|
|
} from './noauth-probe.action';
|
|
|
|
import {
|
|
State,
|
|
initialState,
|
|
} from './noauth-probe.state';
|
|
|
|
import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
|
|
|
|
export function reducer(state = initialState, action: Actions): State {
|
|
switch (action.type) {
|
|
case ActionType.ReadAllByDomain: {
|
|
return {
|
|
...state,
|
|
error: null,
|
|
pending: true,
|
|
};
|
|
}
|
|
|
|
case ActionType.ReadAllByDomainSuccess: {
|
|
return {
|
|
...state,
|
|
error: null,
|
|
pending: false,
|
|
noAuthProbes: action.payload,
|
|
};
|
|
}
|
|
|
|
case ActionType.ReadAllByDomainFailure: {
|
|
return {
|
|
...state,
|
|
error: action.payload,
|
|
pending: false,
|
|
noAuthProbes: null,
|
|
};
|
|
}
|
|
|
|
case ActionType.Accept: {
|
|
return {
|
|
...state,
|
|
error: null,
|
|
pending: true,
|
|
};
|
|
}
|
|
|
|
case ActionType.AcceptSuccess: {
|
|
return {
|
|
...state,
|
|
error: null,
|
|
pending: false,
|
|
noAuthProbes: action.payload,
|
|
};
|
|
}
|
|
|
|
case ActionType.AcceptFailure: {
|
|
return {
|
|
...state,
|
|
error: action.payload,
|
|
pending: false,
|
|
};
|
|
}
|
|
|
|
case ActionType.Deny: {
|
|
return {
|
|
...state,
|
|
error: null,
|
|
pending: true,
|
|
};
|
|
}
|
|
|
|
case ActionType.DenySuccess: {
|
|
return {
|
|
...state,
|
|
error: null,
|
|
pending: false,
|
|
noAuthProbes: action.payload,
|
|
};
|
|
}
|
|
|
|
case ActionType.DenyFailure: {
|
|
return {
|
|
...state,
|
|
error: action.payload,
|
|
pending: false,
|
|
};
|
|
}
|
|
case ActionType.OnConnect: {
|
|
|
|
return {
|
|
...state,
|
|
};
|
|
}
|
|
case ActionType.OnDisconnect: {
|
|
return {
|
|
...state,
|
|
};
|
|
}
|
|
default: {
|
|
return state;
|
|
}
|
|
}
|
|
}
|