Skip to content

Commit

Permalink
Update url
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmfinol committed Aug 30, 2024
1 parent 272ebaa commit d7ec982
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 78 deletions.
2 changes: 2 additions & 0 deletions app/[username]/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import AutoUpdateUrl from "@/components/autoUpdateUrl";
import CgsDeepLink from "@/components/cgsDeepLink";
import { getGame } from "@/lib/firebase/firestore";
import Link from "next/link";
Expand Down Expand Up @@ -27,6 +28,7 @@ export default async function Page({
</Link>
</li>
</ul>
<AutoUpdateUrl url={game.autoUpdateUrl} />
</section>
);
}
4 changes: 4 additions & 0 deletions components/uploadGameForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ function AutoUpdateUrlForm() {
uploadedAt: serverTimestamp(),
};
console.log(game);
const isValidUrl = isValidHttpsUrl(game.bannerImageUrl);
if (!isValidUrl) {
throw new Error("Invalid bannerImageUrl!");
}
await addDoc(collection(db, "games"), game);
setLoading(false);
router.push(`/${username}/${slug}`);
Expand Down
170 changes: 92 additions & 78 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d7ec982

Please sign in to comment.