Skip to content

Commit

Permalink
[refactor] ♻️ refactor icp handle urls
Browse files Browse the repository at this point in the history
  • Loading branch information
dappsar committed Sep 29, 2024
1 parent 58b9e32 commit e5e2a47
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
7 changes: 2 additions & 5 deletions src/config-global.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { paths } from 'src/routes/paths'

import { Network } from './types/networks'

// ----------------------------------------------------------------------
Expand Down Expand Up @@ -31,16 +29,15 @@ export const handleVercelFreePlanTimeOut =
export const UI_API_URL = process.env.NEXT_PUBLIC_UI_URL
export const USE_MOCK = (process.env.NEXT_PUBLIC_USE_MOCK || 'true') === 'true'
export const ALLOWED_ORIGINS = process.env.NEXT_PUBLIC_ALLOWED_ORIGINS || '*'
export const fromICP = (process.env.NEXT_PUBLIC_FROM_ICP || 'false') === 'true'
export const fromICP = (process.env.NEXT_PUBLIC_FROM_ICP || 'true') === 'true'
export const RECAPTCHA_SITE_KEY = process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY || ''
export const NFT_IMAGE_REPOSITORY = (
process.env.NEXT_PUBLIC_NFT_IMAGE_REPOSITORY || 'gcp'
).toLowerCase()
// ----------------------------------------------------------------------

// internal
export const DOMAIN_TO_USE_WITH_ICP = fromICP ? 'https://chatterpay.net' : ''
export const PATH_AFTER_LOGIN = `${DOMAIN_TO_USE_WITH_ICP}$/dashboard`
export const PATH_AFTER_LOGIN = `/dashboard`
export const BOT_WAPP_URL =
'https://api.whatsapp.com/send/?phone=5491164629653&text=MESSAGE&type=phone_number&app_absent=0'

Expand Down
14 changes: 8 additions & 6 deletions src/layouts/common/login-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { paths } from 'src/routes/paths'
import { RouterLink } from 'src/routes/components'

import { useTranslate } from 'src/locales'
import { fromICP } from 'src/config-global'

// ----------------------------------------------------------------------

Expand All @@ -18,18 +19,19 @@ export default function LoginButton({ sx }: Props) {
return (
<>
<Button
component={RouterLink}
component={fromICP ? 'a' : RouterLink}
href={paths.auth.jwt.register}
variant='contained'
sx={{ mr: 1, ...sx }}
>
{t('home.header.sign-up')}
</Button>
<Button
component={RouterLink}
href={paths.auth.jwt.login}
variant='soft'
sx={{ mr: 1, ...sx }}>
<Button
component={fromICP ? 'a' : RouterLink}
href={paths.auth.jwt.login}
variant='soft'
sx={{ mr: 1, ...sx }}
>
{t('home.header.sign-in')}
</Button>
</>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/paths.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const ROOTS = {
AUTH: 'https://chatterpay.net/auth',
AUTH: '/auth',
DASHBOARD: '/dashboard'
}

Expand Down

0 comments on commit e5e2a47

Please sign in to comment.