wow
This commit is contained in:
parent
68bb75b1c8
commit
fa35d5c305
3 changed files with 46 additions and 20 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue