fix: Fixed site query parameter not getting appended to external profile auth URL

This commit is contained in:
Maniload
2025-05-16 01:29:56 +02:00
parent 10d4144313
commit 7827a8acd2
@@ -55,8 +55,11 @@ interface ExternalProfileAddFormProps {
function ExternalProfileAddForm({ preselectedSite, onCancel }: ExternalProfileAddFormProps) {
const [site, setSite] = useState<ExternalProfileSite | "">(preselectedSite ?? "");
const authUrl = `${CLIENT_API_URL}/externaltoken/auth`;
return (
<StyledForm action={site ? getAuthUrl(site) : undefined}>
<StyledForm action={authUrl}>
<input type="hidden" name="site" value={site} />
<SearchFilterGroup>
<SearchFilter>
<Text variant="h2">External Site</Text>
@@ -94,12 +97,3 @@ function ExternalProfileAddForm({ preselectedSite, onCancel }: ExternalProfileAd
</StyledForm>
);
}
function getAuthUrl(site: ExternalProfileSite): string {
switch (site) {
case "AniList":
return `${CLIENT_API_URL}/externaltoken/auth?site=AniList`;
case "MyAnimeList":
return `${CLIENT_API_URL}/externaltoken/auth?site=MyAnimeList`;
}
}