parseHash -> parseLocationHash
This commit is contained in:
parent
25d8ac6593
commit
dd1ccac706
@ -35,7 +35,7 @@ import { NotificationsToastArea } from '@/layout/NotificationsToastArea';
|
||||
import { DialogManager } from '@/layout/DialogManager';
|
||||
import { GlobalCommandDialog } from '@/views/dialogs/GlobalCommandDialog';
|
||||
|
||||
import { parseHash } from '@/lib/urlUtils';
|
||||
import { parseLocationHash } from '@/lib/urlUtils';
|
||||
import { config } from '@/lib/wagmi';
|
||||
|
||||
import { breakpoints } from '@/styles';
|
||||
@ -75,7 +75,7 @@ const Content = () => {
|
||||
if (location.hash === '') {
|
||||
return '';
|
||||
}
|
||||
return parseHash(location.hash);
|
||||
return parseLocationHash(location.hash);
|
||||
}, [location.hash]);
|
||||
|
||||
return (
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { parseHash } from '@/lib/urlUtils';
|
||||
import { parseLocationHash } from '@/lib/urlUtils';
|
||||
|
||||
describe('parseHash', () => {
|
||||
describe('parseLocationHash', () => {
|
||||
it('returns the path separated from hash', () => {
|
||||
const hash = '#/markets';
|
||||
expect(parseHash(hash)).toEqual('/markets');
|
||||
expect(parseLocationHash(hash)).toEqual('/markets');
|
||||
});
|
||||
it('returns the path and query string separated from hash', () => {
|
||||
const hash = '#/markets?displayinitializingmarkets=true';
|
||||
expect(parseHash(hash)).toEqual('/markets?displayinitializingmarkets=true');
|
||||
expect(parseLocationHash(hash)).toEqual('/markets?displayinitializingmarkets=true');
|
||||
});
|
||||
});
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* @param hash location.hash
|
||||
* @returns path and query string if hash parameter is not empty
|
||||
*/
|
||||
export const parseHash = (hash: string) => {
|
||||
export const parseLocationHash = (hash: string) => {
|
||||
if (!hash || hash.length === 0) return '';
|
||||
|
||||
// Remove '#' and split by '?'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user