File size: 740 Bytes
b59aa07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
 * Checks if the current page is the Terms of Service acceptance page.
 * This function works outside of React Router context by checking window.location directly.
 *
 * @param {string} [pathname] - Optional pathname from React Router's useLocation hook
 * @returns {boolean} True if the current page is the TOS acceptance page, false otherwise.
 */
export const isOnTosPage = (pathname?: string): boolean => {
  // If pathname is provided (from React Router), use it
  if (pathname !== undefined) {
    return pathname === "/accept-tos";
  }

  // Otherwise check window.location (works outside React Router context)
  if (typeof window !== "undefined") {
    return window.location.pathname === "/accept-tos";
  }

  return false;
};