mirror of
https://github.com/opensupports/opensupports.git
synced 2025-09-26 03:18:55 +02:00
[DEV-268] Fix long loading time in homepage (#1206)
This commit is contained in:
parent
d3b47eaa73
commit
b620baf5ed
@ -5,6 +5,7 @@ import classNames from 'classnames';
|
|||||||
import i18n from 'lib-app/i18n';
|
import i18n from 'lib-app/i18n';
|
||||||
import API from 'lib-app/api-call';
|
import API from 'lib-app/api-call';
|
||||||
import history from 'lib-app/history';
|
import history from 'lib-app/history';
|
||||||
|
import SessionStore from 'lib-app/session-store';
|
||||||
|
|
||||||
import Captcha from 'app/main/captcha';
|
import Captcha from 'app/main/captcha';
|
||||||
import SubmitButton from 'core-components/submit-button';
|
import SubmitButton from 'core-components/submit-button';
|
||||||
@ -33,11 +34,22 @@ class MainSignUpWidget extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
API.call({
|
if(!SessionStore.getItem('customFields')) {
|
||||||
path: '/system/get-custom-fields',
|
API.call({
|
||||||
data: {}
|
path: '/system/get-custom-fields',
|
||||||
})
|
data: {}
|
||||||
.then(result => this.setState({customFields: result.data}));
|
})
|
||||||
|
.then(result => {
|
||||||
|
SessionStore.storeCustomField(result.data);
|
||||||
|
this.setState({
|
||||||
|
customFields: result.data
|
||||||
|
});
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.setState({
|
||||||
|
customFields: SessionStore.getCustomFields()
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -48,6 +48,10 @@ class SessionStore {
|
|||||||
return JSON.parse(this.getItem('departments'));
|
return JSON.parse(this.getItem('departments'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCustomFields() {
|
||||||
|
return JSON.parse(this.getItem('customFields'));
|
||||||
|
}
|
||||||
|
|
||||||
storeRememberData({token, userId, expiration, isStaff}) {
|
storeRememberData({token, userId, expiration, isStaff}) {
|
||||||
this.setItem('rememberData-token', token);
|
this.setItem('rememberData-token', token);
|
||||||
this.setItem('rememberData-userId', userId);
|
this.setItem('rememberData-userId', userId);
|
||||||
@ -55,6 +59,10 @@ class SessionStore {
|
|||||||
this.setItem('rememberData-expiration', expiration);
|
this.setItem('rememberData-expiration', expiration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
storeCustomField(customFields) {
|
||||||
|
this.setItem('customFields', JSON.stringify(customFields));
|
||||||
|
}
|
||||||
|
|
||||||
storeConfigs(configs) {
|
storeConfigs(configs) {
|
||||||
this.setItem('session-prefix', configs['session-prefix']);
|
this.setItem('session-prefix', configs['session-prefix']);
|
||||||
this.setItem('language', configs.language);
|
this.setItem('language', configs.language);
|
||||||
@ -70,8 +78,6 @@ class SessionStore {
|
|||||||
this.setItem('maintenance-mode', configs['maintenance-mode']);
|
this.setItem('maintenance-mode', configs['maintenance-mode']);
|
||||||
this.setItem('max-size', configs['max-size']);
|
this.setItem('max-size', configs['max-size']);
|
||||||
this.setItem('tags', JSON.stringify(configs['tags']));
|
this.setItem('tags', JSON.stringify(configs['tags']));
|
||||||
this.setItem('max-size', configs['max-size']);
|
|
||||||
this.setItem('tags', JSON.stringify(configs['tags']));
|
|
||||||
this.setItem('default-is-locked', configs['default-is-locked']);
|
this.setItem('default-is-locked', configs['default-is-locked']);
|
||||||
this.setItem('default-department-id', configs['default-department-id']);
|
this.setItem('default-department-id', configs['default-department-id']);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user