Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 03e1368

Browse files
committed
fix: documentation fix
1 parent 10d288a commit 03e1368

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/hooks/useLoginUrl/index.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import { generateLoginUrl, getServerConfig } from '@site/src/utils';
22
import { useCallback } from 'react';
3+
import { useLocation } from '@docusaurus/router';
34

45
const useLoginUrl = () => {
5-
const getUrl = useCallback((language = 'en') => {
6-
const { appId, oauth } = getServerConfig();
7-
const pathname = window.location.pathname;
8-
const route = pathname.replace(/\//g, '%2F'); //replacement is done for backend to understand the route
6+
const location = useLocation();
7+
const getUrl = useCallback(
8+
(language = 'en') => {
9+
const { appId, oauth } = getServerConfig();
10+
const pathname = window.location.pathname;
11+
const route = pathname.replace(/\//g, '%2F'); //replacement is done for backend to understand the route
912

10-
return generateLoginUrl(language, oauth, appId, route);
11-
}, []);
13+
return generateLoginUrl(language, oauth, appId, route);
14+
},
15+
[location],
16+
);
1217

1318
return { getUrl };
1419
};

0 commit comments

Comments
 (0)