This commit is contained in:
암냥 2026-04-23 18:50:15 +09:00
commit fa35d5c305
No known key found for this signature in database
3 changed files with 46 additions and 20 deletions

View file

@ -2,6 +2,7 @@
import { FormEvent, useEffect, useMemo, useState } from "react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import Header from "../../components/header";
type SourceType = "twitter" | "pixiv";
@ -32,6 +33,7 @@ type UploadApiResponse = {
message: string;
savedCount?: number;
failedCount?: number;
ids?: string[];
};
type ExistsApiResponse = {
@ -63,6 +65,7 @@ function splitTags(text: string) {
}
export default function AddPage() {
const router = useRouter();
const [url, setUrl] = useState("");
const [author, setAuthor] = useState("");
const [tagsText, setTagsText] = useState("");
@ -313,6 +316,10 @@ export default function AddPage() {
}
setSuccess(message);
if (data?.ids && data.ids.length > 0) {
router.push(`/detail/${data.ids[0]}`);
}
} catch (submitError) {
setError(submitError instanceof Error ? submitError.message : "업로드에 실패했습니다.");
} finally {