mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-22 12:00:41 +03:00
32 lines
No EOL
795 B
Text
32 lines
No EOL
795 B
Text
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<%- include("extra/meta", {title: "Avatar Upload Panel!" }) %>
|
|
|
|
<body style="text-align: center;">
|
|
<%- include("extra/navbar") %>
|
|
<h1>Upload avatar for <%= member.name %></h1>
|
|
<form>
|
|
<input type="file" name="avatar" /><br>
|
|
<input class="btn-primary" type="submit" value="Upload" />
|
|
</form>
|
|
|
|
<script>
|
|
const form = document.querySelector('form');
|
|
form.addEventListener('submit', async e => {
|
|
e.preventDefault();
|
|
|
|
const res = await fetch('/api/users/<%= member.id %>/', {
|
|
method: 'PUT',
|
|
body: new FormData(form)
|
|
})
|
|
if (res.error) return alert(res.error);
|
|
alert('Success!');
|
|
location.href = "/users/<%= member.id %>"
|
|
});
|
|
</script>
|
|
<%- include("extra/footer") %>
|
|
|
|
</body>
|
|
|
|
</html> |