custom app rendering
This commit is contained in:
@@ -83,7 +83,11 @@ class Announcements extends Shadow {
|
||||
.display("none")
|
||||
.visibility("hidden")
|
||||
.onChange((e) => {
|
||||
this.handleUpload(e.target.files[0]);
|
||||
const file = e.target.files[0]
|
||||
if (!file) return
|
||||
this.stagedImage = file
|
||||
this.stagedImageURL = URL.createObjectURL(file)
|
||||
this.rerender()
|
||||
})
|
||||
|
||||
div("+")
|
||||
@@ -138,8 +142,8 @@ class Announcements extends Shadow {
|
||||
this.style.backgroundColor = "var(--accent)"
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
|
||||
$("appmenu-").display("none")
|
||||
this.focus()
|
||||
}, 20)
|
||||
console.log($("appmenu-"))
|
||||
this.style.backgroundColor = "var(--searchbackground)"
|
||||
@@ -169,6 +173,31 @@ class Announcements extends Shadow {
|
||||
})
|
||||
}
|
||||
|
||||
async handleUpload(file) {
|
||||
try {
|
||||
const body = new FormData();
|
||||
body.append('image', file);
|
||||
const res = await util.authFetch(`${util.HOST}/profile/upload-image`, {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
headers: {
|
||||
"Accept": "application/json"
|
||||
},
|
||||
body: body
|
||||
});
|
||||
|
||||
if(res.status === 401) {
|
||||
return res.status
|
||||
}
|
||||
if (!res.ok) return res.status;
|
||||
const data = await res.json()
|
||||
global.profile = data.member
|
||||
console.log(global.profile)
|
||||
} catch (err) { // Network error / Error reaching server
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
addPhoto() {
|
||||
console.log("hey")
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ class PeopleCard extends Shadow {
|
||||
render() {
|
||||
HStack(() => {
|
||||
HStack(() => {
|
||||
console.log(this.imgSrc)
|
||||
if (this.imgSrc && !this.imgSrc.includes("null")) {
|
||||
img(this.imgSrc, "3em", "3em")
|
||||
.borderRadius(100, pct)
|
||||
|
||||
Reference in New Issue
Block a user