feat: continue in web when invite link redirected

This commit is contained in:
Tristan Yang
2023-03-23 11:08:28 +08:00
parent fe55f49bfc
commit bf63ec6d12
+5 -3
View File
@@ -1,16 +1,18 @@
import { useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { NavLink } from 'react-router-dom';
import { NavLink, useSearchParams } from 'react-router-dom';
import { isMobile } from '../../common/utils';
export default function SignInLink({ token }: { token?: string }) {
const { t } = useTranslation("auth");
let [searchParams] = useSearchParams(new URLSearchParams(location.search));
const ctx = searchParams.get("ctx") ?? "app";
useEffect(() => {
// 移动端访问,则跳转
if (isMobile() && !!token) {
if (isMobile() && !!token && ctx == "app") {
location.href = `https://join.voce.chat/download?link=${encodeURIComponent(`${location.origin}&magic_token=${token}`)}`;
}
}, [token]);
}, [token, ctx]);
return (
<div className="flex gap-1 mt-7 text-sm text-slate-500 dark:text-gray-100 justify-center">