diff --git a/backend/src/Controller/RequestController.php b/backend/src/Controller/RequestController.php
deleted file mode 100644
index a800465..0000000
--- a/backend/src/Controller/RequestController.php
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
- } />
-
-
-
- )
- }
+ render () {
+ return (
+
+
+
+
+
+
+
+
+ } />
+
+
+
+ );
+ }
}
export const ConnectedApp = connect()(App);
export const HotApp = hot(module)(ConnectedApp);
-
diff --git a/frontend/src/components/ProjectList.js b/frontend/src/components/ProjectList.js
index 35bd13d..ce6821b 100644
--- a/frontend/src/components/ProjectList.js
+++ b/frontend/src/components/ProjectList.js
@@ -1,5 +1,5 @@
-import React from 'react'
-import ProjectTile from './ProjectTile'
+import React from 'react';
+import ProjectTile from './ProjectTile';
export default ({ projects, withRequest }) => (
@@ -9,4 +9,4 @@ export default ({ projects, withRequest }) => (
))
}
-)
+);
diff --git a/frontend/src/components/ProjectTile.js b/frontend/src/components/ProjectTile.js
index ca4b6df..162852a 100644
--- a/frontend/src/components/ProjectTile.js
+++ b/frontend/src/components/ProjectTile.js
@@ -1,11 +1,11 @@
-import React from 'react'
-import RequestList from './RequestList'
+import React from 'react';
+import RequestList from './RequestList';
export default ({ project, withRequest }) => (
@@ -9,4 +9,4 @@ export default ({ requests }) => (
))
}
-)
+);
diff --git a/frontend/src/components/RequestTile.js b/frontend/src/components/RequestTile.js
index 6338754..9e4bf37 100644
--- a/frontend/src/components/RequestTile.js
+++ b/frontend/src/components/RequestTile.js
@@ -1,6 +1,6 @@
-import React from 'react'
-import styles from './RequestTile.css'
-import { Link } from 'react-router-dom'
+import React from 'react';
+import styles from './RequestTile.css';
+import { Link } from 'react-router-dom';
export default ({ request }) => (
+
- {
- messages.map((m, i) => {
- return (
-
- )
- })
- }
+ {
+ messages.map((m, i) => {
+ return (
+
+ );
+ })
+ }
diff --git a/frontend/src/errors/api.error.js b/frontend/src/errors/api.error.js
index 1caa9aa..c34e2b7 100644
--- a/frontend/src/errors/api.error.js
+++ b/frontend/src/errors/api.error.js
@@ -1,10 +1,10 @@
export class APIError extends Error {
- constructor(endpoint, code, message, data) {
+ constructor(endpoint, code, message, data) {
super(`APIError: ${message}`);
this.endpoint = endpoint;
this.code = code;
this.data = data;
- Error.captureStackTrace(this, APIError);
+ Error.captureStackTrace(this, APIError);
}
getEndpoint() {
diff --git a/frontend/src/errors/unauthorized.error.js b/frontend/src/errors/unauthorized.error.js
index 6562173..065ea20 100644
--- a/frontend/src/errors/unauthorized.error.js
+++ b/frontend/src/errors/unauthorized.error.js
@@ -1,6 +1,6 @@
export class UnauthorizedError extends Error {
- constructor() {
- super("Unauthorized");
- Error.captureStackTrace(this, UnauthorizedError);
- }
+ constructor() {
+ super('Unauthorized');
+ Error.captureStackTrace(this, UnauthorizedError);
+ }
}
diff --git a/frontend/src/index.js b/frontend/src/index.js
index 52cbc42..edd30bf 100644
--- a/frontend/src/index.js
+++ b/frontend/src/index.js
@@ -1,14 +1,14 @@
-import ReactDOM from 'react-dom'
-import { HotApp as App } from './app'
-import { configureStore } from './store/store'
-import { Provider } from 'react-redux'
+import ReactDOM from 'react-dom';
+import { HotApp as App } from './app';
+import { configureStore } from './store/store';
+import { Provider } from 'react-redux';
import 'bulma/css/bulma.min.css';
-const store = configureStore()
+const store = configureStore();
ReactDOM.render(
,
document.getElementById('app')
-)
+);
diff --git a/frontend/src/pages/DashBoardClient.js b/frontend/src/pages/DashBoardClient.js
index 6f4ad8b..b1b89bb 100644
--- a/frontend/src/pages/DashBoardClient.js
+++ b/frontend/src/pages/DashBoardClient.js
@@ -1,5 +1,5 @@
-import React, { useEffect } from 'react'
-import { connect } from 'react-redux'
+import React, { useEffect } from 'react';
+import { connect } from 'react-redux';
import Page from './page';
import ProjectList from '../components/ProjectList';
import { projectUserListRequest } from '../actions/project';
@@ -7,8 +7,8 @@ import { projectUserListRequest } from '../actions/project';
const DashBoardClient = ({ projects = [], ...props }) => {
useEffect(() => {
- props.dispatch(projectUserListRequest())
- }, [])
+ props.dispatch(projectUserListRequest());
+ }, []);
projects = [
{
id: 1,
@@ -78,7 +78,7 @@ const DashBoardClient = ({ projects = [], ...props }) => {
]
},
- ]
+ ];
return (
@@ -87,11 +87,11 @@ const DashBoardClient = ({ projects = [], ...props }) => {
);
- }
+};
const mapStateToProps = ({ project }) => ({
projects: project.items,
-})
+});
-export default connect(mapStateToProps)(DashBoardClient)
\ No newline at end of file
+export default connect(mapStateToProps)(DashBoardClient);
\ No newline at end of file
diff --git a/frontend/src/pages/DashBoardDev.js b/frontend/src/pages/DashBoardDev.js
index 1c0d68b..7d8f7eb 100644
--- a/frontend/src/pages/DashBoardDev.js
+++ b/frontend/src/pages/DashBoardDev.js
@@ -1,5 +1,5 @@
-import React, { useEffect } from 'react'
-import { connect } from 'react-redux'
+import React, { useEffect } from 'react';
+import { connect } from 'react-redux';
import Page from './page';
import ProjectList from '../components/ProjectList';
import { projectList } from '../actions/project';
@@ -7,8 +7,8 @@ import { projectList } from '../actions/project';
const DashBoardDev = ({ projects = [], ...props }) => {
useEffect(() => {
- props.dispatch(projectList())
- }, [])
+ props.dispatch(projectList());
+ }, []);
projects = [
{
id: 1,
@@ -78,7 +78,7 @@ const DashBoardDev = ({ projects = [], ...props }) => {
]
},
- ]
+ ];
return (
@@ -87,11 +87,11 @@ const DashBoardDev = ({ projects = [], ...props }) => {
);
- }
+};
const mapStateToProps = ({ project }) => ({
projects: project.items,
-})
+});
-export default connect(mapStateToProps)(DashBoardDev)
\ No newline at end of file
+export default connect(mapStateToProps)(DashBoardDev);
\ No newline at end of file
diff --git a/frontend/src/pages/home.js b/frontend/src/pages/home.js
index d47ff81..d1df6d1 100644
--- a/frontend/src/pages/home.js
+++ b/frontend/src/pages/home.js
@@ -1,4 +1,4 @@
-import React from 'react'
+import React from 'react';
import Page from './page';
import { ExtendedUserForm as UserForm } from '../components/UserForm';
import { connect } from 'react-redux';
@@ -6,45 +6,45 @@ import { createUser } from '../actions/user.actions';
export class HomePage extends React.PureComponent {
- render() {
+ render() {
- const { createUserFormError } = this.props;
+ const { createUserFormError } = this.props;
const onUserFormSubmit = ({ username, password }) => {
- this.props.dispatch(createUser(username, password));
- };
+ this.props.dispatch(createUser(username, password));
+ };
- return (
-
-
-
Bienvenue sur PleaseWait !
-
Le gestionnaire de ticket simplifié.
-
Se déconnecter
-
-
-
- );
- }
+ return (
+
+
+
Bienvenue sur PleaseWait !
+
Le gestionnaire de ticket simplifié.
+
Se déconnecter
+
+
+
+ );
+ }
}
function transformErrorCode(code) {
- switch (code) {
- case 0:
- return {
- username: {
- hasError: true,
- message: "Le nom d'utilisateur ne peut pas être vide. (API)"
- }
- }
- default:
- return null;
- }
+ switch (code) {
+ case 0:
+ return {
+ username: {
+ hasError: true,
+ message: 'Le nom d\'utilisateur ne peut pas être vide. (API)'
+ }
+ };
+ default:
+ return null;
+ }
}
function mapStateToProps({ users }) {
- return {
- createUserFormError: transformErrorCode(users.createUserForm.errorCode),
- }
+ return {
+ createUserFormError: transformErrorCode(users.createUserForm.errorCode),
+ };
}
-export const ConnectedHomePage = connect(mapStateToProps)(HomePage)
+export const ConnectedHomePage = connect(mapStateToProps)(HomePage);
diff --git a/frontend/src/pages/login.js b/frontend/src/pages/login.js
index 45044bb..fc5f0c9 100644
--- a/frontend/src/pages/login.js
+++ b/frontend/src/pages/login.js
@@ -1,4 +1,4 @@
-import React, { useState, useEffect } from 'react'
+import React, { useState, useEffect } from 'react';
import { ConnectedPage as Page } from './page';
import { login } from '../actions/auth.actions';
import { connect } from 'react-redux';
@@ -13,10 +13,10 @@ export function LoginPage({ dispatch, isLoggedIn, history }) {
evt.preventDefault();
const { username, password } = formData;
dispatch(login(username, password));
- }
+ };
useEffect(() => {
- if (isLoggedIn) history.push('/home');
+ if (isLoggedIn) history.push('/home');
}, [isLoggedIn]);
return (
diff --git a/frontend/src/pages/logout.js b/frontend/src/pages/logout.js
index 1764623..9defeb1 100644
--- a/frontend/src/pages/logout.js
+++ b/frontend/src/pages/logout.js
@@ -1,4 +1,4 @@
-import React, { useEffect } from 'react'
+import React, { useEffect } from 'react';
import { logout } from '../actions/auth.actions';
import { connect } from 'react-redux';
import { ConnectedPage as Page } from './page';
@@ -16,7 +16,7 @@ export function LogoutPage({ dispatch }) {
- )
+ );
}
export const ConnectedLogoutPage = connect()(LogoutPage);
\ No newline at end of file
diff --git a/frontend/src/pages/page.js b/frontend/src/pages/page.js
index 510092d..a4c70f9 100644
--- a/frontend/src/pages/page.js
+++ b/frontend/src/pages/page.js
@@ -1,33 +1,33 @@
-import React, { useEffect } from 'react'
+import React, { useEffect } from 'react';
import { MessageList } from '../components/message-list';
import { connect } from 'react-redux';
import { removeOldestMessage } from '../actions/message.actions';
export default function Page({ title, messages, dispatch, children }) {
- useEffect(() => {
- document.title = title ? `${title } - PleaseWait` : 'PleaseWait';
- });
+ useEffect(() => {
+ document.title = title ? `${title } - PleaseWait` : 'PleaseWait';
+ });
- useEffect(() => {
- if (!Array.isArray(messages) || messages.length === 0) return;
+ useEffect(() => {
+ if (!Array.isArray(messages) || messages.length === 0) return;
- let timeoutId = setTimeout(() => {
- dispatch(removeOldestMessage());
- }, 5000);
+ let timeoutId = setTimeout(() => {
+ dispatch(removeOldestMessage());
+ }, 5000);
- return () => clearTimeout(timeoutId);
- }, [messages])
+ return () => clearTimeout(timeoutId);
+ }, [messages]);
- return (
-
-
- { children }
-
- );
+ return (
+
+
+ { children }
+
+ );
}
function mapStateToProps(state) {
- return { messages: state.messages.sortedByTimestamp };
+ return { messages: state.messages.sortedByTimestamp };
}
export const ConnectedPage = connect(mapStateToProps)(Page);
\ No newline at end of file
diff --git a/frontend/src/reducers/messages.reducers.js b/frontend/src/reducers/messages.reducers.js
index 59a87db..03cae5d 100644
--- a/frontend/src/reducers/messages.reducers.js
+++ b/frontend/src/reducers/messages.reducers.js
@@ -1,4 +1,4 @@
-import { ADD_MESSAGE, REMOVE_OLDEST_MESSAGE } from "../actions/message.actions";
+import { ADD_MESSAGE, REMOVE_OLDEST_MESSAGE } from '../actions/message.actions';
const initialState = {
sortedByTimestamp: []
@@ -6,11 +6,11 @@ const initialState = {
export function messagesReducer(state = initialState, action) {
switch(action.type) {
- case ADD_MESSAGE:
- return handleAddMessage(state, action);
- case REMOVE_OLDEST_MESSAGE:
- return handleRemoveOldestMessage(state, action);
- };
+ case ADD_MESSAGE:
+ return handleAddMessage(state, action);
+ case REMOVE_OLDEST_MESSAGE:
+ return handleRemoveOldestMessage(state, action);
+ }
return state;
}
@@ -21,12 +21,12 @@ function handleAddMessage(state, action) {
{ ts: Date.now(), text: action.text, type: action.messageType },
...state.sortedByTimestamp
]
- }
-};
+ };
+}
function handleRemoveOldestMessage(state, action) {
return {
...state,
sortedByTimestamp: state.sortedByTimestamp.slice(0, -1)
- }
-};
\ No newline at end of file
+ };
+}
\ No newline at end of file
diff --git a/frontend/src/reducers/project.js b/frontend/src/reducers/project.js
index 6e74768..188493e 100644
--- a/frontend/src/reducers/project.js
+++ b/frontend/src/reducers/project.js
@@ -1,15 +1,15 @@
import {
PROJECT_USER_LIST_SUCCESS,
PROJECT_USER_LIST_FAILURE
-} from '../actions/project'
+} from '../actions/project';
const initialState = {
items: []
-}
+};
export default (state = initialState, action) => {
- console.log(`Action: ${JSON.stringify(action)}`)
+ console.log(`Action: ${JSON.stringify(action)}`);
switch (action.type) {
@@ -17,15 +17,15 @@ export default (state = initialState, action) => {
return {
...state,
items: action.projects
- }
+ };
case PROJECT_USER_LIST_FAILURE:
return {
...state,
items: [],
error: action.error
- }
+ };
}
- return state
+ return state;
-}
\ No newline at end of file
+};
\ No newline at end of file
diff --git a/frontend/src/reducers/session.reducers.js b/frontend/src/reducers/session.reducers.js
index a709959..3c35bf8 100644
--- a/frontend/src/reducers/session.reducers.js
+++ b/frontend/src/reducers/session.reducers.js
@@ -1,4 +1,4 @@
-import { LOGIN_SUCCESS, LOGOUT_SUCCESS } from "../actions/auth.actions";
+import { LOGIN_SUCCESS, LOGOUT_SUCCESS } from '../actions/auth.actions';
const initialState = {
isLoggedIn: false,
@@ -7,11 +7,11 @@ const initialState = {
export function sessionReducer(state = initialState, action) {
switch(action.type) {
- case LOGIN_SUCCESS:
- return handleLoginSuccess(state, action);
- case LOGOUT_SUCCESS:
- return handleLogoutSuccess(state, action);
- };
+ case LOGIN_SUCCESS:
+ return handleLoginSuccess(state, action);
+ case LOGOUT_SUCCESS:
+ return handleLogoutSuccess(state, action);
+ }
return state;
}
@@ -22,13 +22,13 @@ function handleLoginSuccess(state, action) {
user: {
username: action.username,
},
- }
-};
+ };
+}
function handleLogoutSuccess(state, action) {
return {
...state,
isLoggedIn: false,
user: null,
- }
-};
\ No newline at end of file
+ };
+}
\ No newline at end of file
diff --git a/frontend/src/reducers/users.reducers.js b/frontend/src/reducers/users.reducers.js
index d6dfdd1..dba3c20 100644
--- a/frontend/src/reducers/users.reducers.js
+++ b/frontend/src/reducers/users.reducers.js
@@ -1,4 +1,4 @@
-import { CREATE_USER_FAILURE } from "../actions/user.actions";
+import { CREATE_USER_FAILURE } from '../actions/user.actions';
const initialState = {
byId: {},
@@ -7,9 +7,9 @@ const initialState = {
export function usersReducer(state = initialState, action) {
switch(action.type) {
- case CREATE_USER_FAILURE:
- return handleCreateUserFailure(state, action);
- };
+ case CREATE_USER_FAILURE:
+ return handleCreateUserFailure(state, action);
+ }
return state;
}
diff --git a/frontend/src/sagas/auth/login.saga.js b/frontend/src/sagas/auth/login.saga.js
index 74f00f7..32b0ebd 100644
--- a/frontend/src/sagas/auth/login.saga.js
+++ b/frontend/src/sagas/auth/login.saga.js
@@ -11,20 +11,20 @@ export function* loginSaga(action) {
result = yield call(client.login, action.username, action.password);
} catch(err) {
if (err instanceof UnauthorizedError) {
- yield put(addMessage('warning', "Identifiants invalides."));
+ yield put(addMessage('warning', 'Identifiants invalides.'));
return;
}
yield put(loginFailure(action.username, err));
- yield put(addMessage('danger', "Une erreur inconnue bloque le fonctionnement normal de l'application. Veuillez réessayer plus tard."));
- return
+ yield put(addMessage('danger', 'Une erreur inconnue bloque le fonctionnement normal de l\'application. Veuillez réessayer plus tard.'));
+ return;
}
if ('error' in result) {
yield put(loginFailure(action.username, result.error));
const message = result.error.message ? result.error.message : result.error.toString();
yield put(addMessage('danger', message));
- return
+ return;
}
yield put(loginSuccess(action.username));
diff --git a/frontend/src/sagas/auth/logout-redirect.saga.js b/frontend/src/sagas/auth/logout-redirect.saga.js
index 8140dbb..3727d7a 100644
--- a/frontend/src/sagas/auth/logout-redirect.saga.js
+++ b/frontend/src/sagas/auth/logout-redirect.saga.js
@@ -1,8 +1,8 @@
-import { history } from "../../util/history";
+import { history } from '../../util/history';
import { addMessage } from '../../actions/message.actions';
import { put } from 'redux-saga/effects';
export function* logoutRedirectSaga() {
- yield put(addMessage("success", "Vous êtes déconnecté."));
- history.push('/login');
+ yield put(addMessage('success', 'Vous êtes déconnecté.'));
+ history.push('/login');
}
diff --git a/frontend/src/sagas/auth/logout.saga.js b/frontend/src/sagas/auth/logout.saga.js
index 4d9db86..74555a8 100644
--- a/frontend/src/sagas/auth/logout.saga.js
+++ b/frontend/src/sagas/auth/logout.saga.js
@@ -1,6 +1,6 @@
-import { APIClient } from "../../services/api-client.service";
-import { logoutFailure, logoutSuccess } from "../../actions/auth.actions";
-import { addMessage } from "../../actions/message.actions";
+import { APIClient } from '../../services/api-client.service';
+import { logoutFailure, logoutSuccess } from '../../actions/auth.actions';
+import { addMessage } from '../../actions/message.actions';
import { call, put } from 'redux-saga/effects';
export function* logoutSaga() {
@@ -10,7 +10,7 @@ export function* logoutSaga() {
result = yield call(client.logout);
} catch(err) {
yield put(logoutFailure(err));
- yield put(addMessage('danger', "Une erreur inconnue bloque le fonctionnement normal de l'application. Veuillez réessayer plus tard."));
+ yield put(addMessage('danger', 'Une erreur inconnue bloque le fonctionnement normal de l\'application. Veuillez réessayer plus tard.'));
return;
}
@@ -18,7 +18,7 @@ export function* logoutSaga() {
yield put(logoutFailure(result.error));
const message = result.error.message ? result.error.message : result.error.toString();
yield put(addMessage('danger', message));
- return
+ return;
}
yield put(logoutSuccess());
diff --git a/frontend/src/sagas/auth/root.saga.js b/frontend/src/sagas/auth/root.saga.js
index 14458c0..f3aed61 100644
--- a/frontend/src/sagas/auth/root.saga.js
+++ b/frontend/src/sagas/auth/root.saga.js
@@ -1,14 +1,14 @@
-import { LOGIN_REQUEST, LOGOUT_REQUEST, LOGOUT_SUCCESS } from "../../actions/auth.actions";
-import { loginSaga } from "./login.saga";
-import { logoutSaga } from "./logout.saga";
-import { logoutRedirectSaga } from "./logout-redirect.saga";
+import { LOGIN_REQUEST, LOGOUT_REQUEST, LOGOUT_SUCCESS } from '../../actions/auth.actions';
+import { loginSaga } from './login.saga';
+import { logoutSaga } from './logout.saga';
+import { logoutRedirectSaga } from './logout-redirect.saga';
import { all, takeLatest } from 'redux-saga/effects';
export function * rootSaga() {
- yield all([
+ yield all([
takeLatest(LOGIN_REQUEST, loginSaga),
- takeLatest(LOGOUT_REQUEST, logoutSaga),
- // Redirect after logout success
- takeLatest(LOGOUT_SUCCESS, logoutRedirectSaga),
- ]);
+ takeLatest(LOGOUT_REQUEST, logoutSaga),
+ // Redirect after logout success
+ takeLatest(LOGOUT_SUCCESS, logoutRedirectSaga),
+ ]);
}
diff --git a/frontend/src/sagas/failure/root.saga.js b/frontend/src/sagas/failure/root.saga.js
index 8537073..ff74e51 100644
--- a/frontend/src/sagas/failure/root.saga.js
+++ b/frontend/src/sagas/failure/root.saga.js
@@ -1,8 +1,8 @@
-import { failureActionSaga } from "./failure.saga";
-import { takeLatest, all } from "redux-saga/effects";
+import { failureActionSaga } from './failure.saga';
+import { takeLatest, all } from 'redux-saga/effects';
export function * rootSaga(action) {
- yield all([
+ yield all([
takeLatest(action => /_FAILURE$/g.test(action.type), failureActionSaga),
- ]);
+ ]);
}
diff --git a/frontend/src/sagas/init/root.saga.js b/frontend/src/sagas/init/root.saga.js
index 324486f..6115c13 100644
--- a/frontend/src/sagas/init/root.saga.js
+++ b/frontend/src/sagas/init/root.saga.js
@@ -1,8 +1,8 @@
import { all } from 'redux-saga/effects';
-import { checkSessionSaga } from './session.saga';
+import { refreshSessionSaga } from './session.saga';
export function* rootSaga() {
- yield all([
- checkSessionSaga(),
- ]);
+ yield all([
+ refreshSessionSaga(),
+ ]);
}
diff --git a/frontend/src/sagas/init/session.saga.js b/frontend/src/sagas/init/session.saga.js
index 65c37a1..c8ce10a 100644
--- a/frontend/src/sagas/init/session.saga.js
+++ b/frontend/src/sagas/init/session.saga.js
@@ -1,11 +1,14 @@
import { APIClient } from '../../services/api-client.service';
-import { call } from 'redux-saga/effects';
+import { call, put } from 'redux-saga/effects';
+import { refreshUserSessionFailure, refreshUserSessionSuccess } from '../../actions/auth.actions';
-export function* checkSessionSaga() {
- const client = new APIClient();
- try {
- yield call(client.retrieveSessionUser);
- } catch(err) {
- console.error(err);
- }
+export function* refreshSessionSaga() {
+ const client = new APIClient();
+ let user;
+ try {
+ user = yield call(client.retrieveSessionUser);
+ } catch(err) {
+ yield put(refreshUserSessionFailure(err));
+ }
+ yield put(refreshUserSessionSuccess(user));
}
diff --git a/frontend/src/sagas/project.js b/frontend/src/sagas/project/project.saga.js
similarity index 87%
rename from frontend/src/sagas/project.js
rename to frontend/src/sagas/project/project.saga.js
index a7cdb22..1979a4d 100644
--- a/frontend/src/sagas/project.js
+++ b/frontend/src/sagas/project/project.saga.js
@@ -2,17 +2,17 @@ import { call, put } from 'redux-saga/effects';
import { projectUserListFailure, projectUserListSuccess, projectListFailure, projectListSuccess } from '../actions/project';
export function* projectUserListSaga() {
- let result
+ let result;
try {
result = yield call(projectUserList);
} catch(err) {
yield put(projectUserListFailure(err));
- return
+ return;
}
if ('error' in result) {
yield put(projectUserListFailure(result.error));
- return
+ return;
}
yield put(projectUserListSuccess(result.data));
@@ -23,22 +23,22 @@ const projectUserList = () => {
method: 'GET',
mode: 'cors',
credentials: 'include'
- }).then(res => res.json())
-}
+ }).then(res => res.json());
+};
export function* projectListSaga() {
- let result
+ let result;
try {
result = yield call(projectList);
} catch(err) {
yield put(projectListFailure(err));
- return
+ return;
}
if ('error' in result) {
yield put(projectListFailure(result.error));
- return
+ return;
}
yield put(projectListSuccess(result.data));
@@ -49,5 +49,5 @@ const projectList = () => {
method: 'GET',
mode: 'cors',
credentials: 'include'
- }).then(res => res.json())
-}
\ No newline at end of file
+ }).then(res => res.json());
+};
\ No newline at end of file
diff --git a/frontend/src/sagas/root.js b/frontend/src/sagas/root.js
index 09aea3d..5b641e3 100644
--- a/frontend/src/sagas/root.js
+++ b/frontend/src/sagas/root.js
@@ -5,10 +5,10 @@ import { rootSaga as initRootSaga } from './init/root.saga';
import { rootSaga as userRootSaga } from './user/root.saga';
export default function* rootSaga() {
- yield all([
- initRootSaga(),
- authRootSaga(),
- failureRootSaga(),
- userRootSaga()
- ]);
+ yield all([
+ initRootSaga(),
+ authRootSaga(),
+ failureRootSaga(),
+ userRootSaga()
+ ]);
}
diff --git a/frontend/src/sagas/user/root.saga.js b/frontend/src/sagas/user/root.saga.js
index 96c98e0..7a7a369 100644
--- a/frontend/src/sagas/user/root.saga.js
+++ b/frontend/src/sagas/user/root.saga.js
@@ -3,7 +3,7 @@ import { CREATE_USER_REQUEST } from '../../actions/user.actions';
import { createUserSaga } from './user.saga';
export function* rootSaga() {
- yield all([
- takeLatest(CREATE_USER_REQUEST, createUserSaga),
- ]);
+ yield all([
+ takeLatest(CREATE_USER_REQUEST, createUserSaga),
+ ]);
}
diff --git a/frontend/src/sagas/user/user.saga.js b/frontend/src/sagas/user/user.saga.js
index c8ed306..bf6ea25 100644
--- a/frontend/src/sagas/user/user.saga.js
+++ b/frontend/src/sagas/user/user.saga.js
@@ -10,7 +10,7 @@ export function* createUserSaga({username, password}) {
} catch(err) {
console.error(err);
yield put(createUserFailure(err));
- return
+ return;
}
yield put(createUserSuccess(user));
diff --git a/frontend/src/services/api-client.service.js b/frontend/src/services/api-client.service.js
index 03ffa7d..57ccb85 100644
--- a/frontend/src/services/api-client.service.js
+++ b/frontend/src/services/api-client.service.js
@@ -5,82 +5,82 @@ export const UnauthorizedStatusCode = 401;
export class APIClient {
constructor(baseURL = 'http://localhost:8001/api/v1') {
- this.baseURL = baseURL;
- this.login = this.login.bind(this);
- this.logout = this.logout.bind(this);
- this.retrieveSessionUser = this.retrieveSessionUser.bind(this);
- this.listUsers = this.listUsers.bind(this);
- this.listRequests = this.listRequests.bind(this);
- this.createUser = this.createUser.bind(this);
+ this.baseURL = baseURL;
+ this.login = this.login.bind(this);
+ this.logout = this.logout.bind(this);
+ this.retrieveSessionUser = this.retrieveSessionUser.bind(this);
+ this.listUsers = this.listUsers.bind(this);
+ this.listRequests = this.listRequests.bind(this);
+ this.createUser = this.createUser.bind(this);
}
- login(username, password) {
+ login(username, password) {
return this._callAPI('/login', { username, password }, 'POST')
.then(result => result.data);
- }
+ }
- logout() {
- return this._callAPI('/logout')
- }
+ logout() {
+ return this._callAPI('/logout');
+ }
- retrieveSessionUser() {
- return this._callAPI('/me')
- .then(result => result.data);
- }
+ retrieveSessionUser() {
+ return this._callAPI('/me')
+ .then(result => result.data);
+ }
- listUsers() {
- return this._callAPI('/users')
- }
+ listUsers() {
+ return this._callAPI('/users');
+ }
- listRequests() {
+ listRequests() {
- }
+ }
- createRequest(request) {
+ createRequest(request) {
- }
+ }
- createUser(username, password) {
- return this._callAPI('/users', { username, password }, 'POST')
- .then(this._withAPIErrorMiddleware('create_user'))
- .then(result => result.data);
- }
+ createUser(username, password) {
+ return this._callAPI('/users', { username, password }, 'POST')
+ .then(this._withAPIErrorMiddleware('create_user'))
+ .then(result => result.data);
+ }
- updateRequestStatus(reqID, newStatus) {
+ updateRequestStatus(reqID, newStatus) {
- }
+ }
- _callAPI(path, body, method='GET') {
+ _callAPI(path, body, method='GET') {
return fetch(this.baseURL + path, {
- method,
- headers: {
- 'Content-Type': 'application/json',
- },
- mode: 'cors',
- credentials: 'include',
- body: JSON.stringify(body),
+ method,
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ mode: 'cors',
+ credentials: 'include',
+ body: JSON.stringify(body),
})
.then(this._withUnauthorizedErrorMiddleware())
- .then(res => res.json())
- }
+ .then(res => res.json());
+ }
- _withUnauthorizedErrorMiddleware() {
- return res => {
- if (res.status === UnauthorizedStatusCode) {
- throw new UnauthorizedError();
- }
- return res;
- }
- }
+ _withUnauthorizedErrorMiddleware() {
+ return res => {
+ if (res.status === UnauthorizedStatusCode) {
+ throw new UnauthorizedError();
+ }
+ return res;
+ };
+ }
- _withAPIErrorMiddleware(endpoint) {
- return result => {
- if (result.error) {
- const { code, message, data } = result.error;
- throw new APIError(endpoint, code, message, data);
- }
- return result;
- }
- }
+ _withAPIErrorMiddleware(endpoint) {
+ return result => {
+ if (result.error) {
+ const { code, message, data } = result.error;
+ throw new APIError(endpoint, code, message, data);
+ }
+ return result;
+ };
+ }
}
diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js
index 39ba660..d5acf04 100644
--- a/frontend/src/store/store.js
+++ b/frontend/src/store/store.js
@@ -1,18 +1,18 @@
-import { createStore, applyMiddleware, combineReducers, compose } from 'redux'
-import createSagaMiddleware from 'redux-saga'
-import rootSaga from '../sagas/root'
+import { createStore, applyMiddleware, combineReducers, compose } from 'redux';
+import createSagaMiddleware from 'redux-saga';
+import rootSaga from '../sagas/root';
import { sessionReducer } from '../reducers/session.reducers';
import { messagesReducer } from '../reducers/messages.reducers';
-import project from '../reducers/project'
+import project from '../reducers/project';
import { usersReducer } from '../reducers/users.reducers';
-const sagaMiddleware = createSagaMiddleware()
+const sagaMiddleware = createSagaMiddleware();
const rootReducer = combineReducers({
- session: sessionReducer,
- messages: messagesReducer,
- project,
- users: usersReducer,
+ session: sessionReducer,
+ messages: messagesReducer,
+ project,
+ users: usersReducer,
});
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
@@ -24,7 +24,7 @@ export function configureStore(initialState = {}) {
composeEnhancers(
applyMiddleware(sagaMiddleware)
)
- )
+ );
sagaMiddleware.run(rootSaga);
return store;
}