슬러그 수정
This commit is contained in:
+4
-17
@@ -226,24 +226,11 @@ function EditorPageInner() {
|
||||
return;
|
||||
}
|
||||
|
||||
const now = new Date();
|
||||
const datePart = [
|
||||
now.getFullYear().toString().padStart(4, "0"),
|
||||
(now.getMonth() + 1).toString().padStart(2, "0"),
|
||||
now.getDate().toString().padStart(2, "0"),
|
||||
].join("");
|
||||
const randomSlug = Array.from({ length: 12 }, () =>
|
||||
Math.floor(Math.random() * 36).toString(36),
|
||||
).join("");
|
||||
|
||||
const timePart = [
|
||||
now.getHours().toString().padStart(2, "0"),
|
||||
now.getMinutes().toString().padStart(2, "0"),
|
||||
now.getSeconds().toString().padStart(2, "0"),
|
||||
].join("");
|
||||
|
||||
const randomPart = Math.random().toString(36).slice(2, 6);
|
||||
|
||||
const generatedSlug = `page-${datePart}-${timePart}-${randomPart}`;
|
||||
|
||||
updateProjectConfig({ slug: generatedSlug });
|
||||
updateProjectConfig({ slug: randomSlug });
|
||||
}, [searchParams, projectConfig?.slug, updateProjectConfig]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -169,6 +169,7 @@ describe("EditorPage - 서버 자동 저장", () => {
|
||||
|
||||
expect(typeof body.slug).toBe("string");
|
||||
expect(body.slug).not.toBe("my-landing");
|
||||
expect(body.slug.startsWith("page-")).toBe(false);
|
||||
expect(mockState.projectConfig.slug).toBe(body.slug);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user