Compare commits
3 Commits
5fb016a679
...
7e1a64c27b
Author | SHA1 | Date |
---|---|---|
|
7e1a64c27b | |
|
7cd40357ab | |
|
d07e0742f7 |
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "network-resurrector-frontend",
|
"name": "network-resurrector-frontend",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"description": "Frontend component of Network resurrector system",
|
"description": "Frontend component of Network resurrector system",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Tudor Stanciu",
|
"name": "Tudor Stanciu",
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@flare/js-utils": "^1.0.3",
|
"@flare/js-utils": "^1.0.3",
|
||||||
"@flare/tuitio-client-react": "^1.0.1",
|
"@flare/tuitio-client-react": "^1.1.1",
|
||||||
"@material-ui/core": "^4.11.2",
|
"@material-ui/core": "^4.11.2",
|
||||||
"@material-ui/icons": "^4.11.2",
|
"@material-ui/icons": "^4.11.2",
|
||||||
"axios": "^1.3.4",
|
"axios": "^1.3.4",
|
||||||
|
|
|
@ -3,10 +3,16 @@ import { IconButton, Menu, MenuItem } from "@material-ui/core";
|
||||||
import AccountCircle from "@material-ui/icons/AccountCircle";
|
import AccountCircle from "@material-ui/icons/AccountCircle";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useHistory } from "react-router-dom";
|
||||||
import { useTuitioClient } from "@flare/tuitio-client-react";
|
import { useTuitioClient } from "@flare/tuitio-client-react";
|
||||||
|
import { useToast } from "../../hooks";
|
||||||
|
|
||||||
const ProfileButton = () => {
|
const ProfileButton = () => {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const { logout } = useTuitioClient();
|
const { error } = useToast();
|
||||||
|
|
||||||
|
const { logout } = useTuitioClient({
|
||||||
|
onLogoutFailed: errorMessage => error(errorMessage),
|
||||||
|
onLogoutError: err => error(err.message)
|
||||||
|
});
|
||||||
|
|
||||||
const [anchorEl, setAnchorEl] = useState(null);
|
const [anchorEl, setAnchorEl] = useState(null);
|
||||||
const openUserMenu = Boolean(anchorEl);
|
const openUserMenu = Boolean(anchorEl);
|
||||||
|
@ -53,7 +59,7 @@ const ProfileButton = () => {
|
||||||
>
|
>
|
||||||
Profile
|
Profile
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem onClick={() => logout()}>Logout</MenuItem>
|
<MenuItem onClick={logout}>Logout</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -27,20 +27,16 @@ const LoggedInComponent = ({ credentials, onChange, onLogin, onLogout }) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [expanded, setExpanded] = useState(false);
|
const [expanded, setExpanded] = useState(false);
|
||||||
const { info } = useToast();
|
const { info } = useToast();
|
||||||
const { lastLoginDate, userName } = useTuitioUser();
|
const { userName } = useTuitioUser();
|
||||||
|
|
||||||
const handleExpandLogin = () => {
|
const handleExpandLogin = () => {
|
||||||
setExpanded(!expanded);
|
setExpanded(!expanded);
|
||||||
};
|
};
|
||||||
|
|
||||||
const loginDate = useMemo(() => {
|
const loginDate = useMemo(() => {
|
||||||
if (lastLoginDate) {
|
const valueForDisplay = t("LONG_DATE", { date: new Date() });
|
||||||
const valueForDisplay = t("LONG_DATE", { date: lastLoginDate });
|
return valueForDisplay;
|
||||||
return valueForDisplay;
|
}, [t]);
|
||||||
}
|
|
||||||
|
|
||||||
return "N/A";
|
|
||||||
}, [lastLoginDate, t]);
|
|
||||||
|
|
||||||
const handleLogin = async () => {
|
const handleLogin = async () => {
|
||||||
const result = await onLogin();
|
const result = await onLogin();
|
||||||
|
|
|
@ -48,7 +48,7 @@ const LoginComponent = ({ credentials, onChange, onLogin }) => {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardActions>
|
<CardActions className={classes.actions}>
|
||||||
<Button
|
<Button
|
||||||
className={classes.onRight}
|
className={classes.onRight}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
|
|
|
@ -27,6 +27,10 @@ const styles = theme => ({
|
||||||
field: {
|
field: {
|
||||||
margin: theme.spacing(1),
|
margin: theme.spacing(1),
|
||||||
width: "300px"
|
width: "300px"
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
paddingRight: "16px",
|
||||||
|
paddingLeft: "16px"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ function getHeaders() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
Authorization: `Basic ${token.raw}`,
|
Authorization: `Tuitio ${token}`,
|
||||||
"Accept-Language": `${language}`
|
"Accept-Language": `${language}`
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue