Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: positionne la valeur de websocketEndpoint statiquement #1089

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions front/src/createReduxStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const initialState = {
processEndpoint: __PROCESS_ENDPOINT__,
pandocExportEndpoint: __PANDOC_EXPORT_ENDPOINT__,
humanIdRegisterEndpoint: __HUMANID_REGISTER_ENDPOINT__,
websocketEndpoint: toWebsocketEndpoint(__BACKEND_ENDPOINT__)
},
articleStructure: [],
articleVersions: [],
Expand Down Expand Up @@ -88,7 +89,6 @@ export const initialState = {

function createRootReducer (state) {
return createReducer(state, {
APPLICATION_CONFIG: setApplicationConfig,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suite au changement sur la configuration, l’événement APPLICATION_CONFIG n'était plus envoyé et par conséquent la valeur de websocketEndpoint n'était plus calculée.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'adore sa résolution en supprimant du code 😎

PROFILE: setProfile,
CLEAR_ZOTERO_TOKEN: clearZoteroToken,
LOGIN: loginUser,
Expand Down Expand Up @@ -260,15 +260,6 @@ function persistStateIntoLocalStorage ({ getState }) {
}
}

function setApplicationConfig (state, action) {
const applicationConfig = {
...action.applicationConfig,
websocketEndpoint: toWebsocketEndpoint(action.applicationConfig.backendEndpoint)
}

return { ...state, applicationConfig }
}

function setProfile (state, action) {
const { user } = action
if (!user) {
Expand Down
5 changes: 0 additions & 5 deletions front/src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ import Register from './components/Register'
import PrivateRoute from './components/PrivateRoute'
import NotFound from './components/404'
import Error from './components/Error'
import Button from './components/Button'
import Field from './components/Field'
import { Check, Copy, Search } from 'react-feather'
import buttonStyles from './components/button.module.scss'
import Select from './components/Select'
import Story from './stories/Story.jsx'

// lazy loaded routes
Expand Down
Loading