mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 09:25:43 +01:00
added mockup users page and login page
This commit is contained in:
61
scm-ui/src/modules/users.js
Normal file
61
scm-ui/src/modules/users.js
Normal file
@@ -0,0 +1,61 @@
|
||||
//@flow
|
||||
const FETCH_REPOSITORIES = 'smeagol/repositories/FETCH';
|
||||
const FETCH_REPOSITORIES_SUCCESS = 'smeagol/repositories/FETCH_SUCCESS';
|
||||
const FETCH_REPOSITORIES_FAILURE = 'smeagol/repositories/FETCH_FAILURE';
|
||||
|
||||
const THRESHOLD_TIMESTAMP = 10000;
|
||||
|
||||
function requestRepositories() {
|
||||
return {
|
||||
type: FETCH_REPOSITORIES
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function fetchRepositories() {
|
||||
return function(dispatch) {
|
||||
dispatch(requestRepositories());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function shouldFetchRepositories(state: any): boolean {
|
||||
const repositories = state.repositories;
|
||||
return null;
|
||||
}
|
||||
|
||||
export function fetchRepositoriesIfNeeded() {
|
||||
return (dispatch, getState) => {
|
||||
if (shouldFetchRepositories(getState())) {
|
||||
dispatch(fetchRepositories());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default function reducer(state = {}, action = {}) {
|
||||
switch (action.type) {
|
||||
case FETCH_REPOSITORIES:
|
||||
return {
|
||||
...state,
|
||||
loading: true,
|
||||
error: null
|
||||
};
|
||||
case FETCH_REPOSITORIES_SUCCESS:
|
||||
return {
|
||||
...state,
|
||||
loading: false,
|
||||
timestamp: action.timestamp,
|
||||
error: null,
|
||||
repositories: action.payload
|
||||
};
|
||||
case FETCH_REPOSITORIES_FAILURE:
|
||||
return {
|
||||
...state,
|
||||
loading: false,
|
||||
error: action.payload
|
||||
};
|
||||
|
||||
default:
|
||||
return state
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user