mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-31 01:35:15 +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 API from 'lib-app/api-call';
|
||||
import history from 'lib-app/history';
|
||||
import SessionStore from 'lib-app/session-store';
|
||||
|
||||
import Captcha from 'app/main/captcha';
|
||||
import SubmitButton from 'core-components/submit-button';
|
||||
@ -33,11 +34,22 @@ class MainSignUpWidget extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
API.call({
|
||||
path: '/system/get-custom-fields',
|
||||
data: {}
|
||||
})
|
||||
.then(result => this.setState({customFields: result.data}));
|
||||
if(!SessionStore.getItem('customFields')) {
|
||||
API.call({
|
||||
path: '/system/get-custom-fields',
|
||||
data: {}
|
||||
})
|
||||
.then(result => {
|
||||
SessionStore.storeCustomField(result.data);
|
||||
this.setState({
|
||||
customFields: result.data
|
||||
});
|
||||
})
|
||||
} else {
|
||||
this.setState({
|
||||
customFields: SessionStore.getCustomFields()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
|
@ -48,6 +48,10 @@ class SessionStore {
|
||||
return JSON.parse(this.getItem('departments'));
|
||||
}
|
||||
|
||||
getCustomFields() {
|
||||
return JSON.parse(this.getItem('customFields'));
|
||||
}
|
||||
|
||||
storeRememberData({token, userId, expiration, isStaff}) {
|
||||
this.setItem('rememberData-token', token);
|
||||
this.setItem('rememberData-userId', userId);
|
||||
@ -55,6 +59,10 @@ class SessionStore {
|
||||
this.setItem('rememberData-expiration', expiration);
|
||||
}
|
||||
|
||||
storeCustomField(customFields) {
|
||||
this.setItem('customFields', JSON.stringify(customFields));
|
||||
}
|
||||
|
||||
storeConfigs(configs) {
|
||||
this.setItem('session-prefix', configs['session-prefix']);
|
||||
this.setItem('language', configs.language);
|
||||
@ -70,8 +78,6 @@ class SessionStore {
|
||||
this.setItem('maintenance-mode', configs['maintenance-mode']);
|
||||
this.setItem('max-size', configs['max-size']);
|
||||
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-department-id', configs['default-department-id']);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user