mirror of
https://github.com/outline/outline.git
synced 2026-12-02 17:52:07 +03:00
* fix: Spelling, grammar, punctuation, and translation string errors * fix: Remove duplicate period and comma splice from review feedback
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import { useEffect } from "react";
|
|
import styled from "styled-components";
|
|
import Flex from "~/components/Flex";
|
|
import useQuery from "~/hooks/useQuery";
|
|
import Desktop from "~/utils/Desktop";
|
|
import { SigningIn } from "./Login/components/SigningIn";
|
|
|
|
const DesktopRedirect = () => {
|
|
const params = useQuery();
|
|
const token = params.get("token");
|
|
|
|
useEffect(() => {
|
|
if (token) {
|
|
window.open(
|
|
`${Desktop.protocol}://${window.location.host}/auth/redirect?token=${token}`,
|
|
"_self"
|
|
);
|
|
|
|
// Clean the url after a short delay so it's not possible to hit reload, reusing the transfer token
|
|
// will not work and changing the location immediately cancels the window.open call in Safari.
|
|
setTimeout(() => (window.location.search = ""), 500);
|
|
}
|
|
}, [token]);
|
|
|
|
return (
|
|
<Centered align="center" justify="center" column auto>
|
|
<SigningIn />
|
|
</Centered>
|
|
);
|
|
};
|
|
|
|
const Centered = styled(Flex)`
|
|
user-select: none;
|
|
width: 90vw;
|
|
height: 100%;
|
|
max-width: 320px;
|
|
margin: 0 auto;
|
|
`;
|
|
|
|
export default DesktopRedirect;
|