Changed types and resetted tab id when on Admin Page
This commit is contained in:
parent
6d634313e3
commit
28580095dd
6 changed files with 12 additions and 9 deletions
|
|
@ -504,7 +504,7 @@ export const USER_PROJECTS_HEADER = "My Collection";
|
||||||
* @constant
|
* @constant
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export const ADMIN_HEADER_TITLE = "Welcome back!";
|
export const ADMIN_HEADER_TITLE = "Admin Page";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Header description for admin page
|
* Header description for admin page
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,6 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
function hardReset() {
|
function hardReset() {
|
||||||
newNodeId.current = uid();
|
newNodeId.current = uid();
|
||||||
setTabId("");
|
setTabId("");
|
||||||
|
|
||||||
setFlows([]);
|
setFlows([]);
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
setId(uid());
|
setId(uid());
|
||||||
|
|
|
||||||
|
|
@ -400,7 +400,7 @@ export async function renewAccessToken(token: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getLoggedUser(): Promise<Array<Users>> {
|
export async function getLoggedUser(): Promise<Users | null> {
|
||||||
try {
|
try {
|
||||||
const res = await api.get(`${BASE_URL_API}user`);
|
const res = await api.get(`${BASE_URL_API}user`);
|
||||||
|
|
||||||
|
|
@ -411,7 +411,7 @@ export async function getLoggedUser(): Promise<Array<Users>> {
|
||||||
console.log("Error:", error);
|
console.log("Error:", error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
return [];
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function addUser(user: UserInputType): Promise<Array<Users>> {
|
export async function addUser(user: UserInputType): Promise<Array<Users>> {
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ export default function LoginAdminPage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUser() {
|
function getUser() {
|
||||||
if (getAuthentication) {
|
if (getAuthentication()) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getLoggedUser()
|
getLoggedUser()
|
||||||
.then((user) => {
|
.then((user) => {
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import {
|
||||||
} from "../../constants/constants";
|
} from "../../constants/constants";
|
||||||
import { alertContext } from "../../contexts/alertContext";
|
import { alertContext } from "../../contexts/alertContext";
|
||||||
import { AuthContext } from "../../contexts/authContext";
|
import { AuthContext } from "../../contexts/authContext";
|
||||||
|
import { TabsContext } from "../../contexts/tabsContext";
|
||||||
import {
|
import {
|
||||||
addUser,
|
addUser,
|
||||||
deleteUser,
|
deleteUser,
|
||||||
|
|
@ -43,6 +44,13 @@ export default function AdminPage() {
|
||||||
const { userData } = useContext(AuthContext);
|
const { userData } = useContext(AuthContext);
|
||||||
const [totalRowsCount, setTotalRowsCount] = useState(0);
|
const [totalRowsCount, setTotalRowsCount] = useState(0);
|
||||||
|
|
||||||
|
const { setTabId } = useContext(TabsContext);
|
||||||
|
|
||||||
|
// set null id
|
||||||
|
useEffect(() => {
|
||||||
|
setTabId("");
|
||||||
|
}, []);
|
||||||
|
|
||||||
const userList = useRef([]);
|
const userList = useRef([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,6 @@ export default function HomePage(): JSX.Element {
|
||||||
}, []);
|
}, []);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
console.log(isLoading);
|
|
||||||
}, [isLoading]);
|
|
||||||
|
|
||||||
// Personal flows display
|
// Personal flows display
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue