fix(ui) - login check
This commit is contained in:
parent
a63ff8ae12
commit
8fafc878eb
3 changed files with 19 additions and 11 deletions
|
|
@ -66,7 +66,7 @@ const AlertForm = props => {
|
|||
|
||||
const writeQuery = ({ target: { value, name } }) => {
|
||||
const { query } = instance;
|
||||
props.edit({ query: { ...query, [name] : value.value } });
|
||||
props.edit({ query: { ...query, [name] : value } });
|
||||
}
|
||||
|
||||
const metric = (instance && instance.query.left) ? triggerOptions.find(i => i.value === instance.query.left) : null;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ const Header = (props) => {
|
|||
const {
|
||||
sites, location, account,
|
||||
onLogoutClick, siteId,
|
||||
boardingCompletion = 100, fetchSiteList, showAlerts = false
|
||||
boardingCompletion = 100, fetchSiteList, showAlerts = false,
|
||||
} = props;
|
||||
|
||||
const name = account.get('name').split(" ")[0];
|
||||
|
|
@ -53,15 +53,17 @@ const Header = (props) => {
|
|||
let activeSite = null;
|
||||
|
||||
useEffect(() => {
|
||||
if (initialDataFetched) return;
|
||||
if (!account.id || initialDataFetched) return;
|
||||
|
||||
Promise.all([
|
||||
userStore.fetchLimits(),
|
||||
notificationStore.fetchNotificationsCount(),
|
||||
]).then(() => {
|
||||
userStore.updateKey('initialDataFetched', true);
|
||||
});
|
||||
}, []);
|
||||
setTimeout(() => {
|
||||
Promise.all([
|
||||
userStore.fetchLimits(),
|
||||
notificationStore.fetchNotificationsCount(),
|
||||
]).then(() => {
|
||||
userStore.updateKey('initialDataFetched', true);
|
||||
});
|
||||
}, 0);
|
||||
}, [account]);
|
||||
|
||||
useEffect(() => {
|
||||
activeSite = sites.find(s => s.id == siteId);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import React from 'react';
|
|||
|
||||
interface Props {
|
||||
children: React.ReactNode;
|
||||
onSubmit?: any
|
||||
[x: string]: any
|
||||
}
|
||||
|
||||
|
|
@ -23,7 +24,12 @@ function FormField (props: FormFieldProps) {
|
|||
function Form(props: Props) {
|
||||
const { children, ...rest } = props;
|
||||
return (
|
||||
<form {...rest}>
|
||||
<form {...rest} onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
if (props.onSubmit) {
|
||||
props.onSubmit(e);
|
||||
}
|
||||
}}>
|
||||
{children}
|
||||
</form>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue