mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-03 20:25:18 +02:00
null checks
This commit is contained in:
parent
a535072224
commit
feed624601
2 changed files with 8 additions and 4 deletions
|
@ -26,8 +26,10 @@ export const actions: Actions = {
|
||||||
let username = formData.get("username") as string;
|
let username = formData.get("username") as string;
|
||||||
let firstName = formData.get("first_name") as string;
|
let firstName = formData.get("first_name") as string;
|
||||||
let lastName = formData.get("last_name") as string;
|
let lastName = formData.get("last_name") as string;
|
||||||
let icon = formData.get("icon") as string;
|
let icon = event.locals.user?.icon;
|
||||||
let profilePicture = formData.get("profilePicture") as File;
|
let profilePicture = formData.get("profilePicture") as File | null;
|
||||||
|
|
||||||
|
console.log("PROFILE PICTURE" + profilePicture);
|
||||||
|
|
||||||
let password = formData.get("password") as string;
|
let password = formData.get("password") as string;
|
||||||
|
|
||||||
|
@ -75,7 +77,7 @@ export const actions: Actions = {
|
||||||
.where(eq(userTable.id, userId));
|
.where(eq(userTable.id, userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profilePicture) {
|
if (profilePicture?.size && profilePicture.size > 0) {
|
||||||
const response = await event.fetch("/api/upload", {
|
const response = await event.fetch("/api/upload", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: profilePicture,
|
body: profilePicture,
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { enhance } from "$app/forms";
|
import { enhance } from "$app/forms";
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
let username = data.user?.username;
|
let username = data.user?.username;
|
||||||
let first_name = data.user?.first_name;
|
let first_name = data.user?.first_name;
|
||||||
let last_name = data.user?.last_name;
|
let last_name = data.user?.last_name;
|
||||||
|
@ -9,7 +10,8 @@
|
||||||
let icon = data.user?.icon;
|
let icon = data.user?.icon;
|
||||||
let signup_date = data.user?.signup_date;
|
let signup_date = data.user?.signup_date;
|
||||||
let role = data.user?.role;
|
let role = data.user?.role;
|
||||||
let file: File;
|
console.log(username);
|
||||||
|
let file: File | null = null;
|
||||||
|
|
||||||
// the submit function shoud just reload the page
|
// the submit function shoud just reload the page
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue