1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-08-02 19:55:18 +02:00

null checks

This commit is contained in:
Sean Morley 2024-06-10 00:56:25 +00:00
parent a535072224
commit feed624601
2 changed files with 8 additions and 4 deletions

View file

@ -26,8 +26,10 @@ export const actions: Actions = {
let username = formData.get("username") as string;
let firstName = formData.get("first_name") as string;
let lastName = formData.get("last_name") as string;
let icon = formData.get("icon") as string;
let profilePicture = formData.get("profilePicture") as File;
let icon = event.locals.user?.icon;
let profilePicture = formData.get("profilePicture") as File | null;
console.log("PROFILE PICTURE" + profilePicture);
let password = formData.get("password") as string;
@ -75,7 +77,7 @@ export const actions: Actions = {
.where(eq(userTable.id, userId));
}
if (profilePicture) {
if (profilePicture?.size && profilePicture.size > 0) {
const response = await event.fetch("/api/upload", {
method: "POST",
body: profilePicture,

View file

@ -2,6 +2,7 @@
import { enhance } from "$app/forms";
export let data;
let username = data.user?.username;
let first_name = data.user?.first_name;
let last_name = data.user?.last_name;
@ -9,7 +10,8 @@
let icon = data.user?.icon;
let signup_date = data.user?.signup_date;
let role = data.user?.role;
let file: File;
console.log(username);
let file: File | null = null;
// the submit function shoud just reload the page
</script>