mirror of
https://github.com/logos-messaging/examples.waku.org.git
synced 2026-01-06 06:43:06 +00:00
16 lines
427 B
TypeScript
16 lines
427 B
TypeScript
"use client";
|
|
import { usePathname } from "next/navigation";
|
|
|
|
export const useNoteURL = (): undefined | string => {
|
|
const pathname = usePathname();
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const segments = pathname.split("/");
|
|
const viewIndex = segments.indexOf("view");
|
|
const password = urlParams.get("password");
|
|
|
|
return {
|
|
password,
|
|
id: segments[viewIndex + 1] || undefined,
|
|
};
|
|
};
|