Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

cleanup

Blue Mouse3bd4896f9a0d
diff --git a/.gitignore b/.gitignore
index 00625e6a4..ce25195b9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -127,3 +127,4 @@ yarn-debug.log*
yarn-error.log*
package-lock.json
+src/**/*.css
diff --git a/package.json b/package.json
index 9b7ea965d..2b0627f89 100644
--- a/package.json
+++ b/package.json
@@ -30,6 +30,8 @@
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
+ "build:css": "cross-env sass --no-source-map src:src --load-path ./node_modules --style compressed",
+ "watch:css": "cross-env npm run build-css && cross-env sass --no-source-map src:src --load-path ./node_modules --style compressed --watch",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
@@ -50,5 +52,9 @@
"last 1 firefox version",
"last 1 safari version"
]
+ },
+ "devDependencies": {
+ "cross-env": "^7.0.3",
+ "sass": "^1.35.2"
}
}
diff --git a/src/App.js b/src/App.js
index 5be593ae3..70d5a40f8 100644
--- a/src/App.js
+++ b/src/App.js
@@ -35,15 +35,15 @@ const ProtectedViewProject = isAuthenticated(ViewProject)
const App = () => {
const dispatch = useDispatch()
const alert = useAlert()
- const { loading, authenticated } = useSelector(state => state.auth)
- const { error } = useSelector(state => state.errors)
- const { message, type } = useSelector(state => state.alerts)
+ const { loading, authenticated } = useSelector(state => state.auth)
+ const { error } = useSelector(state => state.errors)
+ const { message, type } = useSelector(state => state.alerts)
const accessToken = getAccessToken()
useEffect(() => {
- (async () => {
- if (accessToken) {
- try {
+ (async () => {
+ if (accessToken) {
+ try {
const me = await authMe()
dispatch(authActions.loginSuccess(me))
@@ -51,9 +51,9 @@ const App = () => {
} catch (e) {
dispatch(authActions.logout())
}
- }
- })()
- }, [dispatch, accessToken])
+ }
+ })()
+ }, [dispatch, accessToken])
useEffect(() => {
if (error) {
diff --git a/src/App.scss b/src/App.scss
deleted file mode 100644
index 74b5e0534..000000000
--- a/src/App.scss
+++ /dev/null
@@ -1,38 +0,0 @@
-.App {
- text-align: center;
-}
-
-.App-logo {
- height: 40vmin;
- pointer-events: none;
-}
-
-@media (prefers-reduced-motion: no-preference) {
- .App-logo {
- animation: App-logo-spin infinite 20s linear;
- }
-}
-
-.App-header {
- background-color: #282c34;
- min-height: 100vh;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- font-size: calc(10px + 2vmin);
- color: white;
-}
-
-.App-link {
- color: #61dafb;
-}
-
-@keyframes App-logo-spin {
- from {
- transform: rotate(0deg);
- }
- to {
- transform: rotate(360deg);
- }
-}
diff --git a/src/actions/alerts/index.js b/src/actions/alerts/index.js
index 8c180405d..4a26fd9e0 100644
--- a/src/actions/alerts/index.js
+++ b/src/actions/alerts/index.js
@@ -1,44 +1,44 @@
import { types } from './types'
export const alertsActions = {
- accountDeleted(message, type = 'success') {
- return {
- type: types.ACCOUNT_DELETED,
- payload: { message, type },
- }
- },
-
- accountUpdated(message, type = 'success') {
- return {
- type: types.ACCOUNT_UPDATED,
- payload: { message, type },
- }
- },
-
- newPassword(message, type = 'success') {
- return {
- type: types.NEW_PASSWORD,
- payload: { message, type },
- }
- },
-
- newProject(message, type = 'success') {
- return {
- type: types.CREATE_NEW_PROJECT_SUCCESS,
- payload: { message, type },
- }
- },
+ accountDeleted(message, type = 'success') {
+ return {
+ type: types.ACCOUNT_DELETED,
+ payload: { message, type },
+ }
+ },
+
+ accountUpdated(message, type = 'success') {
+ return {
+ type: types.ACCOUNT_UPDATED,
+ payload: { message, type },
+ }
+ },
+
+ newPassword(message, type = 'success') {
+ return {
+ type: types.NEW_PASSWORD,
+ payload: { message, type },
+ }
+ },
+
+ newProject(message, type = 'success') {
+ return {
+ type: types.CREATE_NEW_PROJECT_SUCCESS,
+ payload: { message, type },
+ }
+ },
- projectDeleted(message, type = 'success') {
- return {
- type: types.CREATE_NEW_PROJECT_SUCCESS,
- payload: { message, type },
- }
- },
+ projectDeleted(message, type = 'success') {
+ return {
+ type: types.CREATE_NEW_PROJECT_SUCCESS,
+ payload: { message, type },
+ }
+ },
- clearAlerts() {
- return {
- type: types.CLEAR_ALERTS,
- }
- },
+ clearAlerts() {
+ return {
+ type: types.CLEAR_ALERTS,
+ }
+ },
}
diff --git a/src/actions/alerts/types.js b/src/actions/alerts/types.js
index d541092bd..9beb21b99 100644
--- a/src/actions/alerts/types.js
+++ b/src/actions/alerts/types.js
@@ -1,12 +1,12 @@
export const types = {
- ACCOUNT_DELETED: 'ACCOUNT_DELETED',
- ACCOUNT_UPDATED: 'ACCOUNT_UPDATED',
- NEW_PASSWORD: 'NEW_PASSWORD',
+ ACCOUNT_DELETED: 'ACCOUNT_DELETED',
+ ACCOUNT_UPDATED: 'ACCOUNT_UPDATED',
+ NEW_PASSWORD: 'NEW_PASSWORD',
- // Projects
- CREATE_NEW_PROJECT_SUCCESS: 'CREATE_NEW_PROJECT_SUCCESS',
- DELETE_PROJECT_SUCCESS: 'DELETE_PROJECT_SUCCESS',
+ // Projects
+ CREATE_NEW_PROJECT_SUCCESS: 'CREATE_NEW_PROJECT_SUCCESS',
+ DELETE_PROJECT_SUCCESS: 'DELETE_PROJECT_SUCCESS',
- // Common
- CLEAR_ALERTS: 'CLEAR_ALERTS'
+ // Common
+ CLEAR_ALERTS: 'CLEAR_ALERTS'
}
diff --git a/src/actions/auth/index.js b/src/actions/auth/index.js
index b519fe9cc..7c5a72d3e 100644
--- a/src/actions/auth/index.js
+++ b/src/actions/auth/index.js
@@ -1,104 +1,104 @@
import { types } from './types'
export const authActions = {
- // Synchronous
- loginSuccess(user) {
- return {
- type: types.LOGIN_SUCCESSFUL,
- payload: { user }
- }
- },
-
- emailVerifySuccess() {
- return {
- type: types.EMAIL_VERIFY_SUCCESSFUL
- }
- },
-
- signupSuccess(user) {
- return {
- type: types.SIGNUP_UP_SUCCESSFUL,
- payload: { user }
- }
- },
-
- updateProfileSuccess(user) {
- return {
- type: types.UPDATE_USER_PROFILE_SUCCESS,
- payload: { user }
- }
- },
-
- logout() {
- localStorage.removeItem('access_token')
- localStorage.removeItem('user_info')
-
- return {
- type: types.LOGOUT
- }
- },
-
- clearErrors() {
- return {
- type: types.CLEAR_ERRORS
- }
- },
-
- savePath(path) {
- return {
- type: types.SAVE_PATH,
- payload: { path }
- }
- },
-
- deleteAccountSuccess() {
- localStorage.removeItem('access_token')
- localStorage.removeItem('user_info')
-
- return {
- type: types.DELETE_ACCOUNT_SUCCESS
- }
- },
-
- finishLoading() {
- return {
- type: types.FINISH_LOADING
- }
- },
-
- // Asynchronous
- loginAsync(credentials) {
- return {
- type: types.LOGIN_ASYNC,
- payload: { credentials }
- }
- },
-
- signupAsync(data, resetRecaptcha) {
- return {
- type: types.SIGNUP_ASYNC,
- payload: { data, resetRecaptcha }
- }
- },
-
- emailVerifyAsync(data, successfulCallback, errorCallback) {
- return {
- type: types.EMAIL_VERIFY_ASYNC,
- payload: { data, successfulCallback, errorCallback }
- }
- },
-
- updateUserProfileAsync(data, successfulCallback = () => {}) {
- return {
- type: types.UPDATE_USER_PROFILE_ASYNC,
- payload: { data, successfulCallback }
- }
- },
-
- deleteAccountAsync(errorCallback) {
- return {
- type: types.DELETE_ACCOUNT_ASYNC,
- payload: { errorCallback }
- }
- }
+ // Synchronous
+ loginSuccess(user) {
+ return {
+ type: types.LOGIN_SUCCESSFUL,
+ payload: { user }
+ }
+ },
+
+ emailVerifySuccess() {
+ return {
+ type: types.EMAIL_VERIFY_SUCCESSFUL
+ }
+ },
+
+ signupSuccess(user) {
+ return {
+ type: types.SIGNUP_UP_SUCCESSFUL,
+ payload: { user }
+ }
+ },
+
+ updateProfileSuccess(user) {
+ return {
+ type: types.UPDATE_USER_PROFILE_SUCCESS,
+ payload: { user }
+ }
+ },
+
+ logout() {
+ localStorage.removeItem('access_token')
+ localStorage.removeItem('user_info')
+
+ return {
+ type: types.LOGOUT
+ }
+ },
+
+ clearErrors() {
+ return {
+ type: types.CLEAR_ERRORS
+ }
+ },
+
+ savePath(path) {
+ return {
+ type: types.SAVE_PATH,
+ payload: { path }
+ }
+ },
+
+ deleteAccountSuccess() {
+ localStorage.removeItem('access_token')
+ localStorage.removeItem('user_info')
+
+ return {
+ type: types.DELETE_ACCOUNT_SUCCESS
+ }
+ },
+
+ finishLoading() {
+ return {
+ type: types.FINISH_LOADING
+ }
+ },
+
+ // Asynchronous
+ loginAsync(credentials) {
+ return {
+ type: types.LOGIN_ASYNC,
+ payload: { credentials }
+ }
+ },
+
+ signupAsync(data, resetRecaptcha) {
+ return {
+ type: types.SIGNUP_ASYNC,
+ payload: { data, resetRecaptcha }
+ }
+ },
+
+ emailVerifyAsync(data, successfulCallback, errorCallback) {
+ return {
+ type: types.EMAIL_VERIFY_ASYNC,
+ payload: { data, successfulCallback, errorCallback }
+ }
+ },
+
+ updateUserProfileAsync(data, successfulCallback = () => {}) {
+ return {
+ type: types.UPDATE_USER_PROFILE_ASYNC,
+ payload: { data, successfulCallback }
+ }
+ },
+
+ deleteAccountAsync(errorCallback) {
+ return {
+ type: types.DELETE_ACCOUNT_ASYNC,
+ payload: { errorCallback }
+ }
+ }
}
diff --git a/src/actions/auth/types.js b/src/actions/auth/types.js
index fb9946f94..303b40991 100644
--- a/src/actions/auth/types.js
+++ b/src/actions/auth/types.js
@@ -1,19 +1,19 @@
export const types = {
- // Synchronous
- FINISH_LOADING: 'FINISH_LOADING',
- LOGIN_SUCCESSFUL: 'LOGIN_SUCCESSFUL',
- EMAIL_VERIFY_SUCCESSFUL: 'EMAIL_VERIFY_SUCCESSFUL',
- EMAIL_VERIFY_FAILED: 'EMAIL_VERIFY_FAILED',
- SIGNUP_UP_SUCCESSFUL: 'SIGNUP_UP_SUCCESSFUL',
- UPDATE_USER_PROFILE_SUCCESS: 'UPDATE_USER_PROFILE_SUCCESS',
- LOGOUT: 'LOGOUT',
- SAVE_PATH: 'SAVE_PATH',
- DELETE_ACCOUNT_SUCCESS: 'DELETE_ACCOUNT_SUCCESS',
+ // Synchronous
+ FINISH_LOADING: 'FINISH_LOADING',
+ LOGIN_SUCCESSFUL: 'LOGIN_SUCCESSFUL',
+ EMAIL_VERIFY_SUCCESSFUL: 'EMAIL_VERIFY_SUCCESSFUL',
+ EMAIL_VERIFY_FAILED: 'EMAIL_VERIFY_FAILED',
+ SIGNUP_UP_SUCCESSFUL: 'SIGNUP_UP_SUCCESSFUL',
+ UPDATE_USER_PROFILE_SUCCESS: 'UPDATE_USER_PROFILE_SUCCESS',
+ LOGOUT: 'LOGOUT',
+ SAVE_PATH: 'SAVE_PATH',
+ DELETE_ACCOUNT_SUCCESS: 'DELETE_ACCOUNT_SUCCESS',
- // Asynchronous
- LOGIN_ASYNC: 'LOGIN_ASYNC',
- SIGNUP_ASYNC: 'SIGNUP_ASYNC',
- EMAIL_VERIFY_ASYNC: 'EMAIL_VERIFY_ASYNC',
- UPDATE_USER_PROFILE_ASYNC: 'UPDATE_USER_PROFILE_ASYNC',
- DELETE_ACCOUNT_ASYNC: 'DELETE_ACCOUNT_ASYNC'
+ // Asynchronous
+ LOGIN_ASYNC: 'LOGIN_ASYNC',
+ SIGNUP_ASYNC: 'SIGNUP_ASYNC',
+ EMAIL_VERIFY_ASYNC: 'EMAIL_VERIFY_ASYNC',
+ UPDATE_USER_PROFILE_ASYNC: 'UPDATE_USER_PROFILE_ASYNC',
+ DELETE_ACCOUNT_ASYNC: 'DELETE_ACCOUNT_ASYNC'
}
diff --git a/src/actions/errors/index.js b/src/actions/errors/index.js
index de73502f3..0985cd6f4 100644
--- a/src/actions/errors/index.js
+++ b/src/actions/errors/index.js
@@ -1,73 +1,73 @@
import { types } from './types'
export const errorsActions = {
- // Authorisation
- loginFailed(error) {
- return {
- type: types.LOGIN_FAILED,
- payload: { error },
- }
- },
-
- signupFailed(error) {
- return {
- type: types.SIGN_UP_FAILED,
- payload: { error },
- }
- },
+ // Authorisation
+ loginFailed(error) {
+ return {
+ type: types.LOGIN_FAILED,
+ payload: { error },
+ }
+ },
+
+ signupFailed(error) {
+ return {
+ type: types.SIGN_UP_FAILED,
+ payload: { error },
+ }
+ },
- createNewPasswordFailed(error) {
- return {
- type: types.CREATE_NEW_PASSWORD_FAILED,
- payload: { error },
- }
- },
+ createNewPasswordFailed(error) {
+ return {
+ type: types.CREATE_NEW_PASSWORD_FAILED,
+ payload: { error },
+ }
+ },
- updateProfileFailed(error) {
- return {
- type: types.UPDATE_USER_PROFILE_FAILED,
- payload: { error },
- }
- },
+ updateProfileFailed(error) {
+ return {
+ type: types.UPDATE_USER_PROFILE_FAILED,
+ payload: { error },
+ }
+ },
- canteensErrors(error) {
- return {
- type: types.CANTEENS_ERRORS,
- payload: { error },
- }
- },
+ canteensErrors(error) {
+ return {
+ type: types.CANTEENS_ERRORS,
+ payload: { error },
+ }
+ },
- deleteAccountFailed(error) {
- return {
- type: types.DELETE_ACCOUNT_FAILED,
- payload: { error },
- }
- },
+ deleteAccountFailed(error) {
+ return {
+ type: types.DELETE_ACCOUNT_FAILED,
+ payload: { error },
+ }
+ },
- createNewProjectFailed(error) {
- return {
- type: types.CREATE_NEW_PROJECT_FAILED,
- payload: { error },
- }
- },
+ createNewProjectFailed(error) {
+ return {
+ type: types.CREATE_NEW_PROJECT_FAILED,
+ payload: { error },
+ }
+ },
- updateProjectFailed(error) {
- return {
- type: types.UPDATE_PROJECT_FAILED,
- payload: { error },
- }
- },
+ updateProjectFailed(error) {
+ return {
+ type: types.UPDATE_PROJECT_FAILED,
+ payload: { error },
+ }
+ },
- deleteProjectFailed(error) {
- return {
- type: types.DELETE_PROJECT_FAILED,
- payload: { error },
- }
- },
+ deleteProjectFailed(error) {
+ return {
+ type: types.DELETE_PROJECT_FAILED,
+ payload: { error },
+ }
+ },
- clearErrors() {
- return {
- type: types.CLEAR_ERRORS,
- }
- },
+ clearErrors() {
+ return {
+ type: types.CLEAR_ERRORS,
+ }
+ },
}
diff --git a/src/actions/errors/types.js b/src/actions/errors/types.js
index f1d8d35fc..1f974238b 100644
--- a/src/actions/errors/types.js
+++ b/src/actions/errors/types.js
@@ -1,16 +1,16 @@
export const types = {
- // Authorisation
- LOGIN_FAILED: 'LOGIN_FAILED',
- SIGN_UP_FAILED: 'SIGN_UP_FAILED',
- UPDATE_USER_PROFILE_FAILED: 'UPDATE_USER_PROFILE_FAILED',
- CREATE_NEW_PASSWORD_FAILED: 'CREATE_NEW_PASSWORD_FAILED',
- DELETE_ACCOUNT_FAILED: 'DELETE_ACCOUNT_FAILED',
+ // Authorisation
+ LOGIN_FAILED: 'LOGIN_FAILED',
+ SIGN_UP_FAILED: 'SIGN_UP_FAILED',
+ UPDATE_USER_PROFILE_FAILED: 'UPDATE_USER_PROFILE_FAILED',
+ CREATE_NEW_PASSWORD_FAILED: 'CREATE_NEW_PASSWORD_FAILED',
+ DELETE_ACCOUNT_FAILED: 'DELETE_ACCOUNT_FAILED',
- // Projects
- CREATE_NEW_PROJECT_FAILED: 'CREATE_NEW_PROJECT_FAILED',
- UPDATE_PROJECT_FAILED: 'UPDATE_PROJECT_FAILED',
- DELETE_PROJECT_FAILED: 'DELETE_PROJECT_FAILED',
+ // Projects
+ CREATE_NEW_PROJECT_FAILED: 'CREATE_NEW_PROJECT_FAILED',
+ UPDATE_PROJECT_FAILED: 'UPDATE_PROJECT_FAILED',
+ DELETE_PROJECT_FAILED: 'DELETE_PROJECT_FAILED',
- // Common
- CLEAR_ERRORS: 'CLEAR_ERRORS',
+ // Common
+ CLEAR_ERRORS: 'CLEAR_ERRORS',
}
diff --git a/src/api/index.js b/src/api/index.js
index 310674b13..0a5a36b16 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -4,153 +4,153 @@ import { authActions } from 'actions/auth'
import { getAccessToken, removeAccessToken } from "utils/accessToken"
const api = axios.create({
- baseURL: process.env.REACT_APP_API_URL,
+ baseURL: process.env.REACT_APP_API_URL,
})
api.interceptors.request.use(
- (config) => {
- const token = getAccessToken()
- if (token) {
- config.headers['Authorization'] = `Bearer ${token}`
- }
- return config
- },
- error => {
- return Promise.reject(error)
- }
+ (config) => {
+ const token = getAccessToken()
+ if (token) {
+ config.headers['Authorization'] = `Bearer ${token}`
+ }
+ return config
+ },
+ error => {
+ return Promise.reject(error)
+ }
)
api.interceptors.response.use(
- response => response,
- error => {
- if (error.response?.data.statusCode === 401) {
- removeAccessToken()
- store.dispatch(authActions.logout())
- }
- return Promise.reject(error)
- }
+ response => response,
+ error => {
+ if (error.response?.data.statusCode === 401) {
+ removeAccessToken()
+ store.dispatch(authActions.logout())
+ }
+ return Promise.reject(error)
+ }
)
export const authMe = () =>
- api
- .get('/auth/me')
- .then(response => response.data)
- .catch(error => {
- throw new Error(error.response.data.message)
- })
+ api
+ .get('/auth/me')
+ .then(response => response.data)
+ .catch(error => {
+ throw new Error(error.response.data.message)
+ })
export const login = (credentials) =>
- api
- .post('/auth/login', credentials)
- .then(response => response.data)
- .catch(error => {
- throw new Error(error.response.data.message)
- })
+ api
+ .post('/auth/login', credentials)
+ .then(response => response.data)
+ .catch(error => {
+ throw new Error(error.response.data.message)
+ })
export const signup = (data) =>
- api
- .post('/auth/register', data)
- .then(response => response.data)
- .catch(error => {
- const errorsArray = error.response.data.message
- if (Array.isArray(errorsArray)) {
- throw errorsArray
- }
- throw new Error(errorsArray)
- })
+ api
+ .post('/auth/register', data)
+ .then(response => response.data)
+ .catch(error => {
+ const errorsArray = error.response.data.message
+ if (Array.isArray(errorsArray)) {
+ throw errorsArray
+ }
+ throw new Error(errorsArray)
+ })
export const deleteUser = () =>
- api
- .delete('/user')
- .then(response => response.data)
- .catch(error => {
- throw new Error(JSON.stringify(error.response.data))
- })
+ api
+ .delete('/user')
+ .then(response => response.data)
+ .catch(error => {
+ throw new Error(JSON.stringify(error.response.data))
+ })
export const changeUserDetails = (data) =>
- api
- .put('/user', data)
- .then(response => response.data)
- .catch(error => {
- const errorsArray = error.response.data.message
- if (Array.isArray(errorsArray)) {
- throw errorsArray
- }
- throw new Error(errorsArray)
- })
+ api
+ .put('/user', data)
+ .then(response => response.data)
+ .catch(error => {
+ const errorsArray = error.response.data.message
+ if (Array.isArray(errorsArray)) {
+ throw errorsArray
+ }
+ throw new Error(errorsArray)
+ })
export const forgotPassword = (email) =>
- api
- .post('/auth/reset-password', email)
- .then(response => response.data)
- .catch(error => {
- throw new Error(error.response.data.message)
- })
+ api
+ .post('/auth/reset-password', email)
+ .then(response => response.data)
+ .catch(error => {
+ throw new Error(error.response.data.message)
+ })
export const confirmEmail = () =>
- api
- .post('/user/confirm_email')
- .then(response => response.data)
- .catch(error => {
- throw new Error(error.response.data.message)
- })
+ api
+ .post('/user/confirm_email')
+ .then(response => response.data)
+ .catch(error => {
+ throw new Error(error.response.data.message)
+ })
export const exportUserData = () =>
- api
- .get('/user/export')
- .then(response => response.data)
- .catch(error => {
- throw new Error(error.response.data.message)
- })
+ api
+ .get('/user/export')
+ .then(response => response.data)
+ .catch(error => {
+ throw new Error(error.response.data.message)
+ })
export const createNewPassword = (id, password) =>
- api
- .post(`/auth/password-reset/${id}`, { password })
- .then(response => response.data)
- .catch(error => {
- const errorsArray = error.response.data.message
- if (Array.isArray(errorsArray)) {
- throw errorsArray
- }
- throw new Error(errorsArray)
- })
+ api
+ .post(`/auth/password-reset/${id}`, { password })
+ .then(response => response.data)
+ .catch(error => {
+ const errorsArray = error.response.data.message
+ if (Array.isArray(errorsArray)) {
+ throw errorsArray
+ }
+ throw new Error(errorsArray)
+ })
export const verifyEmail = ({ path, id }) =>
- api
- .get(`/auth/${path}/${id}`)
- .then(response => response.data)
- .catch(error => {
- throw new Error(error.response.data.message)
- })
+ api
+ .get(`/auth/${path}/${id}`)
+ .then(response => response.data)
+ .catch(error => {
+ throw new Error(error.response.data.message)
+ })
export const getProjects = () =>
- api
- .get(`/project`)
- .then(response => response.data)
- .catch(error => {
- throw new Error(error.response.data.message)
- })
+ api
+ .get(`/project`)
+ .then(response => response.data)
+ .catch(error => {
+ throw new Error(error.response.data.message)
+ })
export const createProject = (data) =>
- api
- .post(`/project`, data)
- .then(response => response.data)
- .catch(error => {
- throw new Error(error.response.data.message)
- })
+ api
+ .post(`/project`, data)
+ .then(response => response.data)
+ .catch(error => {
+ throw new Error(error.response.data.message)
+ })
export const updateProject = (id, data) =>
- api
- .put(`/project/${id}`, data)
- .then(response => response.data)
- .catch(error => {
- throw new Error(error.response.data.message)
- })
+ api
+ .put(`/project/${id}`, data)
+ .then(response => response.data)
+ .catch(error => {
+ throw new Error(error.response.data.message)
+ })
export const deleteProject = (id) =>
- api
- .delete(`/project/${id}`)
- .then(response => response.data)
- .catch(error => {
- throw new Error(error.response.data.message)
- })
\ No newline at end of file
+ api
+ .delete(`/project/${id}`)
+ .then(response => response.data)
+ .catch(error => {
+ throw new Error(error.response.data.message)
+ })
\ No newline at end of file
diff --git a/src/components/Footer/index.jsx b/src/components/Footer/index.jsx
index 0af2f42f1..39a0bc33b 100644
--- a/src/components/Footer/index.jsx
+++ b/src/components/Footer/index.jsx
@@ -1,5 +1,5 @@
import React from 'react'
-import './styles.scss'
+import './styles.css'
import { Link } from 'react-router-dom'
export default () => {
diff --git a/src/hoc/protected.js b/src/hoc/protected.js
index d2cb7f629..2c97774fa 100644
--- a/src/hoc/protected.js
+++ b/src/hoc/protected.js
@@ -2,19 +2,19 @@ import { connectedRouterRedirect } from 'redux-auth-wrapper/history4/redirect'
import routes from 'routes'
export const isAuthenticated = connectedRouterRedirect({
- redirectPath: routes.signin,
- authenticatedSelector: state => state.auth.authenticated,
- wrapperDisplayName: 'userIsAuthenticated',
- allowRedirectBack: false
+ redirectPath: routes.signin,
+ authenticatedSelector: state => state.auth.authenticated,
+ wrapperDisplayName: 'userIsAuthenticated',
+ allowRedirectBack: false
})
export const notAuthenticated = connectedRouterRedirect({
- redirectPath: (state) => {
- const path = state.auth.redirectPath
- return path || routes.dashboard
- },
+ redirectPath: (state) => {
+ const path = state.auth.redirectPath
+ return path || routes.dashboard
+ },
- authenticatedSelector: state => !state.auth.authenticated,
- wrapperDisplayName: 'userIsNotAuthenticated',
- allowRedirectBack: false
+ authenticatedSelector: state => !state.auth.authenticated,
+ wrapperDisplayName: 'userIsNotAuthenticated',
+ allowRedirectBack: false
})
diff --git a/src/index.js b/src/index.js
index 45c339439..a31c5b494 100644
--- a/src/index.js
+++ b/src/index.js
@@ -5,10 +5,11 @@ import { store } from 'store'
import { Provider } from 'react-redux'
import { transitions, positions, Provider as AlertProvider } from 'react-alert'
import AlertTemplate from 'react-alert-template-basic'
-import './index.scss'
import 'bootstrap/dist/css/bootstrap.min.css'
+
import App from './App'
import reportWebVitals from './reportWebVitals'
+import './index.css'
const options = {
position: positions.BOTTOM_RIGHT,
diff --git a/src/pages/Auth/VerifyEmail/index.jsx b/src/pages/Auth/VerifyEmail/index.jsx
index f6fe41434..7d29bdd51 100644
--- a/src/pages/Auth/VerifyEmail/index.jsx
+++ b/src/pages/Auth/VerifyEmail/index.jsx
@@ -18,11 +18,11 @@ const VerifyEmail = () => {
dispatch(authActions.emailVerifyAsync(
{ path, id },
- () => setLoading(false),
- (error) => {
- setError(error.message)
- setLoading(false)
- }))
+ () => setLoading(false),
+ (error) => {
+ setError(error.message)
+ setLoading(false)
+ }))
}, [dispatch, id])
return (
diff --git a/src/pages/UserSettings/UserSettings.container.jsx b/src/pages/UserSettings/UserSettings.container.jsx
index 5ab8efaa3..b7aa62ebc 100644
--- a/src/pages/UserSettings/UserSettings.container.jsx
+++ b/src/pages/UserSettings/UserSettings.container.jsx
@@ -34,27 +34,27 @@ export default () => {
const onSubmit = (data) => {
delete data.repeat
- for (let key in data) {
- if (data[key] === '') {
- delete data[key]
- }
- }
+ for (let key in data) {
+ if (data[key] === '') {
+ delete data[key]
+ }
+ }
- dispatch(
- authActions.updateUserProfileAsync(
+ dispatch(
+ authActions.updateUserProfileAsync(
data,
- () => dispatch(
+ () => dispatch(
alertsActions.accountUpdated('Your account settings have been updated!')
)
- )
- );
+ )
+ );
}
const onEmailConfirm = async (errorCallback) => {
if (getCookie('confirmation_timeout')) {
- dispatch(errorsActions.updateProfileFailed('An email has already been sent, check your mailbox or try again in a few minutes'))
- return
- }
+ dispatch(errorsActions.updateProfileFailed('An email has already been sent, check your mailbox or try again in a few minutes'))
+ return
+ }
try {
const res = await confirmEmail()
diff --git a/src/reducers/alerts.js b/src/reducers/alerts.js
index a7aa4b528..6ff55383e 100644
--- a/src/reducers/alerts.js
+++ b/src/reducers/alerts.js
@@ -1,23 +1,23 @@
import { types } from 'actions/alerts/types'
const initialState = {
- message: null,
- type: 'info'
+ message: null,
+ type: 'info'
}
export default (state = initialState, { type, payload }) => {
- switch (type) {
- case types.ACCOUNT_DELETED:
- case types.ACCOUNT_UPDATED:
- case types.NEW_PASSWORD:
- case types.DELETE_PROJECT_SUCCESS:
- case types.CREATE_NEW_PROJECT_SUCCESS:
- return { ...state, message: payload.message, type: payload.type }
+ switch (type) {
+ case types.ACCOUNT_DELETED:
+ case types.ACCOUNT_UPDATED:
+ case types.NEW_PASSWORD:
+ case types.DELETE_PROJECT_SUCCESS:
+ case types.CREATE_NEW_PROJECT_SUCCESS:
+ return { ...state, message: payload.message, type: payload.type }
- case types.CLEAR_ERRORS:
- return { ...state, message: null, type: 'info' }
+ case types.CLEAR_ERRORS:
+ return { ...state, message: null, type: 'info' }
- default:
- return state
- }
+ default:
+ return state
+ }
}
diff --git a/src/reducers/auth.js b/src/reducers/auth.js
index 886afd461..343f624ac 100644
--- a/src/reducers/auth.js
+++ b/src/reducers/auth.js
@@ -1,35 +1,35 @@
import { types } from 'actions/auth/types'
const initialState = {
- redirectPath: null,
- authenticated: false,
- loading: true,
- user: null
+ redirectPath: null,
+ authenticated: false,
+ loading: true,
+ user: null
}
export default (state = initialState, { type, payload }) => {
- switch (type) {
- case types.SIGNUP_UP_SUCCESSFUL:
- case types.LOGIN_SUCCESSFUL:
- return { ...state, user: payload.user, authenticated: true }
-
- case types.UPDATE_USER_PROFILE_SUCCESS:
- return { ...state, user: payload.user }
-
- case types.EMAIL_VERIFY_SUCCESSFUL:
- return { ...state, user: { ...state.user, isActive: true }}
-
- case types.SAVE_PATH:
- return { ...state, redirectPath: payload.path }
-
- case types.LOGOUT:
- case types.DELETE_ACCOUNT_SUCCESS:
- return { ...state, authenticated: false, user: null }
-
- case types.FINISH_LOADING:
- return { ...state, loading: false }
-
- default:
- return state
- }
+ switch (type) {
+ case types.SIGNUP_UP_SUCCESSFUL:
+ case types.LOGIN_SUCCESSFUL:
+ return { ...state, user: payload.user, authenticated: true }
+
+ case types.UPDATE_USER_PROFILE_SUCCESS:
+ return { ...state, user: payload.user }
+
+ case types.EMAIL_VERIFY_SUCCESSFUL:
+ return { ...state, user: { ...state.user, isActive: true }}
+
+ case types.SAVE_PATH:
+ return { ...state, redirectPath: payload.path }
+
+ case types.LOGOUT:
+ case types.DELETE_ACCOUNT_SUCCESS:
+ return { ...state, authenticated: false, user: null }
+
+ case types.FINISH_LOADING:
+ return { ...state, loading: false }
+
+ default:
+ return state
+ }
}
\ No newline at end of file
diff --git a/src/reducers/errors.js b/src/reducers/errors.js
index 394d73c3b..ea8212485 100644
--- a/src/reducers/errors.js
+++ b/src/reducers/errors.js
@@ -1,25 +1,25 @@
import { types } from 'actions/errors/types'
const initialState = {
- error: null
+ error: null
}
export default (state = initialState, { type, payload }) => {
- switch (type) {
- case types.LOGIN_FAILED:
- case types.SIGN_UP_FAILED:
- case types.UPDATE_USER_PROFILE_FAILED:
- case types.CREATE_NEW_PASSWORD_FAILED:
- case types.DELETE_ACCOUNT_FAILED:
- case types.CREATE_NEW_PROJECT_FAILED:
- case types.UPDATE_PROJECT_FAILED:
- case types.DELETE_PROJECT_FAILED:
- return { ...state, error: payload.error }
+ switch (type) {
+ case types.LOGIN_FAILED:
+ case types.SIGN_UP_FAILED:
+ case types.UPDATE_USER_PROFILE_FAILED:
+ case types.CREATE_NEW_PASSWORD_FAILED:
+ case types.DELETE_ACCOUNT_FAILED:
+ case types.CREATE_NEW_PROJECT_FAILED:
+ case types.UPDATE_PROJECT_FAILED:
+ case types.DELETE_PROJECT_FAILED:
+ return { ...state, error: payload.error }
- case types.CLEAR_ERRORS:
- return { ...state, error: null }
+ case types.CLEAR_ERRORS:
+ return { ...state, error: null }
- default:
- return state
- }
+ default:
+ return state
+ }
}
diff --git a/src/routes.js b/src/routes.js
index ee940388c..0f34fd9ad 100644
--- a/src/routes.js
+++ b/src/routes.js
@@ -1,13 +1,13 @@
export default Object.freeze({
- signin: '/login',
- signup: '/signup',
- reset_password: '/recovery',
- new_password_form: '/password-reset/:id',
- main: '/',
- dashboard: '/dashboard',
- user_settings: '/settings',
- verify: '/verify/:id',
- change_email: '/change-email/:id',
- new_project: '/projects/new',
- project: '/projects/:id',
+ signin: '/login',
+ signup: '/signup',
+ reset_password: '/recovery',
+ new_password_form: '/password-reset/:id',
+ main: '/',
+ dashboard: '/dashboard',
+ user_settings: '/settings',
+ verify: '/verify/:id',
+ change_email: '/change-email/:id',
+ new_project: '/projects/new',
+ project: '/projects/:id',
})
\ No newline at end of file
diff --git a/src/sagas/auth/watchers/index.js b/src/sagas/auth/watchers/index.js
index ea45b757a..6185d252a 100644
--- a/src/sagas/auth/watchers/index.js
+++ b/src/sagas/auth/watchers/index.js
@@ -7,25 +7,25 @@ import updateUserProfile from 'sagas/auth/workers/updateUserProfile'
import deleteUserAccount from "sagas/auth/workers/deleteUserAccount"
function* watchLogin() {
- yield takeLatest(types.LOGIN_ASYNC, signIn)
+ yield takeLatest(types.LOGIN_ASYNC, signIn)
}
function* watchVerifyEmail() {
- yield takeLatest(types.EMAIL_VERIFY_ASYNC, verifyEmail)
+ yield takeLatest(types.EMAIL_VERIFY_ASYNC, verifyEmail)
}
function* watchSignup() {
- yield takeLatest(types.SIGNUP_ASYNC, signUp)
+ yield takeLatest(types.SIGNUP_ASYNC, signUp)
}
function* watchUpdateUserProfile() {
- yield takeLatest(types.UPDATE_USER_PROFILE_ASYNC, updateUserProfile)
+ yield takeLatest(types.UPDATE_USER_PROFILE_ASYNC, updateUserProfile)
}
function* watchDeleteUserProfile() {
- yield takeLatest(types.DELETE_ACCOUNT_ASYNC, deleteUserAccount)
+ yield takeLatest(types.DELETE_ACCOUNT_ASYNC, deleteUserAccount)
}
export default function* watchAuth() {
- yield all([call(watchLogin), call(watchSignup), call(watchVerifyEmail), call(watchUpdateUserProfile), call(watchDeleteUserProfile)])
+ yield all([call(watchLogin), call(watchSignup), call(watchVerifyEmail), call(watchUpdateUserProfile), call(watchDeleteUserProfile)])
}
diff --git a/src/sagas/auth/workers/deleteUserAccount.js b/src/sagas/auth/workers/deleteUserAccount.js
index ab534c397..03ab6f6b5 100644
--- a/src/sagas/auth/workers/deleteUserAccount.js
+++ b/src/sagas/auth/workers/deleteUserAccount.js
@@ -3,12 +3,12 @@ import { authActions } from 'actions/auth'
import { deleteUser } from 'api'
export default function* ({ payload: { errorCallback } }) {
- try {
- yield call(deleteUser)
- yield put(authActions.deleteAccountSuccess())
- } catch (e) {
- errorCallback(JSON.parse(e.message))
- } finally {
- yield put(authActions.finishLoading())
- }
+ try {
+ yield call(deleteUser)
+ yield put(authActions.deleteAccountSuccess())
+ } catch (e) {
+ errorCallback(JSON.parse(e.message))
+ } finally {
+ yield put(authActions.finishLoading())
+ }
}
diff --git a/src/sagas/auth/workers/signin.js b/src/sagas/auth/workers/signin.js
index 2a13d201c..989437f96 100644
--- a/src/sagas/auth/workers/signin.js
+++ b/src/sagas/auth/workers/signin.js
@@ -5,14 +5,14 @@ import { setAccessToken } from 'utils/accessToken'
import { login } from 'api'
export default function* ({ payload: { credentials } }) {
- try {
- const response = yield call(login, credentials)
+ try {
+ const response = yield call(login, credentials)
- yield put(authActions.loginSuccess(response.user))
- yield call(setAccessToken, JSON.stringify(response.access_token))
- } catch (error) {
- yield put(errorsActions.loginFailed(error.message))
- } finally {
- yield put(authActions.finishLoading())
- }
+ yield put(authActions.loginSuccess(response.user))
+ yield call(setAccessToken, JSON.stringify(response.access_token))
+ } catch (error) {
+ yield put(errorsActions.loginFailed(error.message))
+ } finally {
+ yield put(authActions.finishLoading())
+ }
}
diff --git a/src/sagas/auth/workers/signup.js b/src/sagas/auth/workers/signup.js
index 227542e8a..e578d74cd 100644
--- a/src/sagas/auth/workers/signup.js
+++ b/src/sagas/auth/workers/signup.js
@@ -5,15 +5,15 @@ import { setAccessToken } from "utils/accessToken"
import { signup } from 'api'
export default function* ({ payload: { data, resetRecaptcha = () => {} } }) {
- try {
- const response = yield call(signup, data)
+ try {
+ const response = yield call(signup, data)
- yield put(authActions.signupSuccess(response.user))
- yield call(setAccessToken, JSON.stringify(response.access_token))
- } catch (error) {
- yield put(errorsActions.signupFailed(error.message || (typeof error === 'string' ? error : error[0])))
- resetRecaptcha()
- } finally {
- yield put(authActions.finishLoading())
- }
+ yield put(authActions.signupSuccess(response.user))
+ yield call(setAccessToken, JSON.stringify(response.access_token))
+ } catch (error) {
+ yield put(errorsActions.signupFailed(error.message || (typeof error === 'string' ? error : error[0])))
+ resetRecaptcha()
+ } finally {
+ yield put(authActions.finishLoading())
+ }
}
diff --git a/src/sagas/auth/workers/updateUserProfile.js b/src/sagas/auth/workers/updateUserProfile.js
index b79da335c..63bcee767 100644
--- a/src/sagas/auth/workers/updateUserProfile.js
+++ b/src/sagas/auth/workers/updateUserProfile.js
@@ -4,14 +4,14 @@ import { errorsActions } from 'actions/errors'
import { changeUserDetails } from 'api'
export default function* ({ payload: { data, successfulCallback } }) {
- try {
- const user = yield call(changeUserDetails, data)
+ try {
+ const user = yield call(changeUserDetails, data)
- yield put(authActions.updateProfileSuccess(user))
- successfulCallback()
- } catch (error) {
- yield put(errorsActions.updateProfileFailed(error.message || (typeof error === 'string' ? error : error[0])))
- } finally {
- yield put(authActions.finishLoading())
- }
+ yield put(authActions.updateProfileSuccess(user))
+ successfulCallback()
+ } catch (error) {
+ yield put(errorsActions.updateProfileFailed(error.message || (typeof error === 'string' ? error : error[0])))
+ } finally {
+ yield put(authActions.finishLoading())
+ }
}
diff --git a/src/sagas/auth/workers/verifyEmail.js b/src/sagas/auth/workers/verifyEmail.js
index b82d3ed14..3d484ea1e 100644
--- a/src/sagas/auth/workers/verifyEmail.js
+++ b/src/sagas/auth/workers/verifyEmail.js
@@ -3,13 +3,13 @@ import { authActions } from 'actions/auth'
import { verifyEmail } from "api"
export default function* ({ payload: { data, successfulCallback, errorCallback } }) {
- try {
- yield call(verifyEmail, data)
- yield put(authActions.emailVerifySuccess())
- successfulCallback()
- } catch (error) {
- errorCallback(error)
- } finally {
- yield put(authActions.finishLoading())
- }
+ try {
+ yield call(verifyEmail, data)
+ yield put(authActions.emailVerifySuccess())
+ successfulCallback()
+ } catch (error) {
+ errorCallback(error)
+ } finally {
+ yield put(authActions.finishLoading())
+ }
}
diff --git a/src/sagas/index.js b/src/sagas/index.js
index 604e19101..a703d4542 100644
--- a/src/sagas/index.js
+++ b/src/sagas/index.js
@@ -2,5 +2,5 @@ import { all, call } from 'redux-saga/effects'
import watchAuth from 'sagas/auth/watchers'
export default function* rootSaga() {
- yield all([call(watchAuth)])
+ yield all([call(watchAuth)])
}
diff --git a/src/store/index.js b/src/store/index.js
index 5ef2eb182..d37d031cc 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -7,8 +7,8 @@ const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
const sagaMiddleware = createSagaMiddleware()
export const store = createStore(
- root_reducer,
- composeEnhancers(applyMiddleware(sagaMiddleware))
+ root_reducer,
+ composeEnhancers(applyMiddleware(sagaMiddleware))
)
sagaMiddleware.run(root_saga)
\ No newline at end of file
diff --git a/src/utils/accessToken.js b/src/utils/accessToken.js
index 851b7adc6..cd747bec1 100644
--- a/src/utils/accessToken.js
+++ b/src/utils/accessToken.js
@@ -1,24 +1,24 @@
export const getAccessToken = () => {
- const accessToken = localStorage.getItem('access_token')
- let token = null
+ const accessToken = localStorage.getItem('access_token')
+ let token = null
- if (!accessToken) {
- return null
- }
+ if (!accessToken) {
+ return null
+ }
- try {
- token = JSON.parse(accessToken)
- } catch(e) {
- console.error('Error while parsing access token: ' + e)
- }
+ try {
+ token = JSON.parse(accessToken)
+ } catch(e) {
+ console.error('Error while parsing access token: ' + e)
+ }
- return token
+ return token
}
export const setAccessToken = token => {
- localStorage.setItem('access_token', token)
+ localStorage.setItem('access_token', token)
}
export const removeAccessToken = () => {
- localStorage.removeItem('access_token')
+ localStorage.removeItem('access_token')
}