mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-28 05:25:33 +00:00
added app token registration for extension
This commit is contained in:
parent
d797376948
commit
33a70f5705
1 changed files with 14 additions and 2 deletions
|
|
@ -677,7 +677,6 @@ export default function Page() {
|
|||
const {
|
||||
data: waitlistStatus,
|
||||
isLoading: isCheckingWaitlist,
|
||||
error: waitlistError,
|
||||
} = useQuery({
|
||||
queryKey: ["waitlist-status", user?.id],
|
||||
queryFn: async () => {
|
||||
|
|
@ -695,11 +694,24 @@ export default function Page() {
|
|||
retry: 1, // Only retry once on failure
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
// save the token for chrome extension
|
||||
const url = new URL(window.location.href);
|
||||
const rawToken = url.searchParams.get("token");
|
||||
|
||||
if (rawToken) {
|
||||
const encodedToken = encodeURIComponent(rawToken);
|
||||
window.postMessage({ token: encodedToken }, "*");
|
||||
url.searchParams.delete("token");
|
||||
window.history.replaceState({}, "", url.toString());
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (waitlistStatus && !waitlistStatus.accessGranted) {
|
||||
router.push("/waitlist");
|
||||
}
|
||||
}, []);
|
||||
}, [waitlistStatus, router]);
|
||||
|
||||
// Show loading state while checking authentication and waitlist status
|
||||
if (!user || isCheckingWaitlist) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue