Complete more of data transfer request creation process

This commit is contained in:
regalijan 2023-10-19 16:50:33 -04:00
parent 7dcbb85fb1
commit d620e04e21
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

@ -7,6 +7,7 @@ import {
RadioGroup, RadioGroup,
Text, Text,
Textarea, Textarea,
useToast,
} from "@chakra-ui/react"; } from "@chakra-ui/react";
import { useState } from "react"; import { useState } from "react";
@ -15,9 +16,7 @@ export default function () {
return ( return (
<Container maxW="container.md"> <Container maxW="container.md">
<Heading pt="36px">Let's get started</Heading> <Heading pt="36px">Let's get started</Heading>
<Text pt="128px"> <Text pt="128px">Is your old Roblox account banned?</Text>
Are you able to log in to the account you are transferring from?
</Text>
<RadioGroup onChange={(val) => setShowCookieBox(JSON.parse(val))}> <RadioGroup onChange={(val) => setShowCookieBox(JSON.parse(val))}>
<HStack> <HStack>
<Radio value="false">No</Radio> <Radio value="false">No</Radio>
@ -28,9 +27,49 @@ export default function () {
id="cookie-box" id="cookie-box"
placeholder="Paste your .ROBLOSECURITY cookie here" placeholder="Paste your .ROBLOSECURITY cookie here"
pt="16px" pt="16px"
style={{ display: showCookieBox ? "initial" : "unset" }} style={{ display: showCookieBox ? "initial" : "none" }}
/> />
<Button pt="32px">Continue</Button> <Button
onClick={async () => {
const createTransferReq = await fetch("/api/data-transfers/create", {
body: JSON.stringify({
can_access: !showCookieBox,
cookie: (
document.getElementById("cookie-box") as HTMLInputElement
).value,
}),
headers: {
"content-type": "application/json",
},
method: "POST",
});
if (!createTransferReq.ok) {
useToast()({
description: (
(await createTransferReq.json()) as { error: string }
).error,
isClosable: true,
status: "error",
title: "Failed to create transfer request",
});
return;
}
location.assign(
((await createTransferReq.json()) as { url: string }).url,
);
}}
pt="32px"
>
Continue
</Button>
<br />
<Text pt="16px">
If you cannot login at all, please visit the support page and join our
server.
</Text>
</Container> </Container>
); );
} }