import { APIFetchV1 } from "util/api";
import CenterLayoutPage from "components/layout/CenterLayoutPage";
import ApiError from "components/util/ApiError";
import Divider from "components/util/Divider";
import Loading from "components/util/Loading";
import OAuthMoreInfo from "components/util/OAuthMoreInfo";
import useApiQuery from "components/util/query/useApiQuery";
import useQueryString from "components/util/useQueryString";
import React from "react";
import { Link } from "react-router-dom";
import { integer, TachiAPIClientDocument } from "tachi-common";
export default function OAuthRequestAuthPage() {
const params = useQueryString();
const clientID = params.get("clientID");
if (!clientID) {
return (
No ClientID. Whoever gave you this link likely messed up somehow.
Go Home.
);
}
return (
);
}
function OAuthRequestAuthLoader({ clientID }: { clientID: string }) {
const { error, data } = useApiQuery>(
`/clients/${clientID}`
);
if (error) {
return ;
}
if (!data) {
return ;
}
if (!data.redirectUri) {
return (
<>
This client does not support OAuth Flows.
Whoever gave you this link likely messed up somehow.
Go Home.
>
);
}
return ;
}
function OAuthRequestAuthMain({
client,
}: {
client: Omit;
}) {
const params = useQueryString();
const context = params.get("context");
return (
<>
{client.name} is requesting you authenticate with them.