mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2026-03-25 09:43:43 -04:00
null checks
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user