File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
components/admin/requests Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -92,13 +92,23 @@ export default function RequestHeader({
9292 const router = useRouter ( ) ;
9393
9494 const [ backLink , setBackLink ] = useState ( '/admin' ) ;
95+ const [ status , setStatus ] = useState ( router . query . tab ) ;
96+ const [ page , setPage ] = useState ( router . query . page ) ;
97+
9598 const generateBackLink = ( ) => {
9699 const routerQuery = router . query ;
97- const status = typeof routerQuery . tab === 'string' ? routerQuery . tab : applicationStatus ;
98- const page = typeof routerQuery . page === 'string' ? routerQuery . page : '0' ;
100+ typeof routerQuery . tab === 'string' ? setStatus ( routerQuery . tab ) : setStatus ( applicationStatus ) ;
101+ typeof routerQuery . page === 'string' ? setPage ( routerQuery . page ) : setPage ( '0' ) ;
99102 setBackLink ( `/admin?tab=${ status } &page=${ page } ` ) ;
100103 } ;
101104
105+ const formatStatus = ( status : string ) => {
106+ if ( status === 'ALL' ) {
107+ return '' ;
108+ }
109+ return status . toLowerCase ( ) . replace ( '_' , ' ' ) ;
110+ } ;
111+
102112 useEffect ( ( ) => {
103113 generateBackLink ( ) ;
104114 } , [ ] ) ;
@@ -115,7 +125,7 @@ export default function RequestHeader({
115125 < NextLink href = { backLink } passHref >
116126 < Text textStyle = "button-semibold" textColor = "primary" as = "a" >
117127 < ChevronLeftIcon />
118- All requests
128+ All { formatStatus ( status ) } requests
119129 </ Text >
120130 </ NextLink >
121131
You can’t perform that action at this time.
0 commit comments