Skip to content

feat(stably): navigate to magic link url on main #282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/app-config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ export const __DEBUG__ =
!!process.env['DEBUG']

export const isProd = getServerUrl(null).includes('app.openint.dev')

export const isMainPreview = getServerUrl(null).includes(
'openint-git-main-openint-dev.vercel.app',
)
7 changes: 6 additions & 1 deletion apps/web/app/dashboard/(authenticated)/connect/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import {ChevronDown} from 'lucide-react'
import {useState} from 'react'
import {isMainPreview} from '@openint/app-config/constants'
import {customerRouterSchema} from '@openint/engine-backend/router/customerRouter'
import {_trpcReact} from '@openint/engine-frontend'
import {SchemaForm, useToast} from '@openint/ui'
Expand Down Expand Up @@ -157,7 +158,11 @@ export default function MagicLinkPage() {
onSubmit={({formData: values}) => {
createMagicLink.mutate(values, {
onSuccess: async (data) => {
await copyToClipboard(data.url)
if (isMainPreview) {
window.location.href = data.url
} else {
await copyToClipboard(data.url)
}
toast({
title: 'Magic link copied to clipboard',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The success toast always says 'Magic link copied to clipboard', even when redirecting via window.location.href. Consider updating or conditionally showing a more appropriate message.

Suggested change
title: 'Magic link copied to clipboard',
title: isMainPreview ? 'Redirecting to magic link' : 'Magic link copied to clipboard',

variant: 'success',
Expand Down
Loading