mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-10-06 13:35:51 +00:00
22 lines
468 B
TypeScript
22 lines
468 B
TypeScript
![]() |
import { useLocation } from 'umi';
|
||
|
|
||
|
export enum SegmentIndex {
|
||
|
Second = '2',
|
||
|
Third = '3',
|
||
|
}
|
||
|
|
||
|
export const useSegmentedPathName = (index: SegmentIndex) => {
|
||
|
const { pathname } = useLocation();
|
||
|
|
||
|
const pathArray = pathname.split('/');
|
||
|
return pathArray[index] || '';
|
||
|
};
|
||
|
|
||
|
export const useSecondPathName = () => {
|
||
|
return useSegmentedPathName(SegmentIndex.Second);
|
||
|
};
|
||
|
|
||
|
export const useThirdPathName = () => {
|
||
|
return useSegmentedPathName(SegmentIndex.Third);
|
||
|
};
|