Skip to content

Commit

Permalink
Fix username reload in history page (#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
prakhar10 authored Sep 2, 2024
1 parent b32be4c commit 1897f92
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions webapp/src/components/history.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ export function History() {
const [backendMapping, setBackendMapping] = useState<Record<string, string>>({});
const [page, setPage] = useState(1);
const [size] = useState(15);
const [form, setForm] = useState({
user: access.userName
const [form, setForm] = useState(() => {
const username = sessionStorage.getItem('username');
return username ? JSON.parse(username) : { user: access.userName };
});

useEffect(() => {
Expand All @@ -41,6 +42,10 @@ export function History() {
list(1);
}, [form]);

useEffect(() => {
sessionStorage.setItem('username', JSON.stringify({ user: form.user }));
}, [form]);

const list = (p: number) => {
setPage(p);
queryHistoryApi({
Expand Down

0 comments on commit 1897f92

Please sign in to comment.