diff --git a/src/components/profile-selector/MyAccountMenu.tsx b/src/components/profile-selector/MyAccountMenu.tsx index df660ebb7..ad77d1021 100644 --- a/src/components/profile-selector/MyAccountMenu.tsx +++ b/src/components/profile-selector/MyAccountMenu.tsx @@ -1,4 +1,3 @@ -import { useRouter } from 'next/router' import React, { createContext, FC, useContext, useEffect, useRef, useState } from 'react' import { getCurrentUrlOrigin } from 'src/utils/url' import { InfoDetails } from '../profiles/address-views' @@ -67,14 +66,18 @@ const MyAccountDrawerContext = createContext(initV export const useMyAccountDrawer = () => useContext(MyAccountDrawerContext) function parseMessage(data: string) { - const [origin, name, value] = data.split(':') + const match = data.match(/^([^:]+):([^:]+):(.+)$/) + if (!match) return null + + const origin = match[1] + const name = match[2] + const value = match[3] if (origin !== 'grill') return null return { name: name ?? '', value: value ?? '' } } export const AccountMenu: React.FunctionComponent = ({ address, owner }) => { const iframeRef = useRef(null) const [isOpenProfileModal, setIsOpenProfileModal] = useState(false) - const router = useRouter() useEffect(() => { window.onmessage = event => { @@ -84,8 +87,9 @@ export const AccountMenu: React.FunctionComponent = ({ address, ow const { name, value } = message if (name === 'profile' && value === 'close') { setIsOpenProfileModal(false) - } else if (name === 'redirect') { - router.push(value) + } else if (name === 'redirect' || name === 'redirect-hard') { + // Using router push for redirect don't redirect properly, it just have loading for a bit and changes the url much later + window.location.href = value setIsOpenProfileModal(false) } } diff --git a/src/config/app/grill/index.ts b/src/config/app/grill/index.ts index 403a67628..46df7cf5d 100644 --- a/src/config/app/grill/index.ts +++ b/src/config/app/grill/index.ts @@ -9,7 +9,7 @@ const index: AppConfig = { appBaseUrl: 'https://grillapp.net', themeName: undefined, metaTags: { - siteName: 'Grill: Grill: Monetize Every Like, Comment, Post | Web3 Social', + siteName: 'Grill: Monetize Every Like, Comment, Post | Web3 Social', title: 'Grill: Monetize Every Like, Comment, Post | Web3 Social', desc: 'Revolutionary Web3 social finance platform where bloggers and their followers earn together. Blockchain, NFT, and crypto content.', defaultImage: '/images/grill-default-cover.png',