Skip to content

Commit cfeda6e

Browse files
committed
Changes to be committed:
new file: pages/dash.html modified: pages/profile.html
1 parent 6c257c2 commit cfeda6e

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

pages/dash.html

Whitespace-only changes.

pages/profile.html

+34-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<div class="text-center ml-20 lg:text-left">
5252
<div class="avatar" onclick="my_modal_1.showModal()">
5353
<div id = "pic" class="w-24 rounded-full shadow-2xl" >
54-
<img id="profilePic" src="http://localhost:8017/api/person/image/${userEmail}" onerror="handleImageError()"/>
54+
<!-- <img id="profilePic" src="http://localhost:8017/api/person/image/${userEmail}" onerror="handleImageError()"/> -->
5555
</div>
5656
</div>
5757
<dialog id="my_modal_1" class="modal">
@@ -116,8 +116,11 @@ <h2 class="text-2xl mb-4">Stock Predictions</h2>
116116

117117

118118
<script>
119-
const decodedToken = parseJwt(token);
119+
120+
const token1 = getCookie("token");
121+
const decodedToken = parseJwt(token1);
120122
const userEmail = decodedToken.sub;
123+
document.getElementById('pic').innerHTML = `<img id="profilePic" src="http://localhost:8017/api/person/image/${userEmail}" onerror="handleImageError()"/>`;
121124
function handleImageError() {
122125
imgElement = document.getElementById('profilePic');
123126

@@ -290,6 +293,25 @@ <h2 class="text-2xl mb-4">Stock Predictions</h2>
290293
.then(response => response.json())
291294
.then(data => {
292295
console.log(data);
296+
297+
298+
299+
300+
301+
302+
303+
304+
305+
306+
307+
308+
309+
310+
311+
312+
313+
314+
293315
if (data.status !== 401) {
294316
showSuccessMessage("Data successful! Your data has been created.");
295317
tickerInput.value = "";
@@ -317,7 +339,7 @@ <h2 class="text-2xl mb-4">Stock Predictions</h2>
317339

318340
fetch("http://localhost:8017/api/person/stats/" + userId, requestOptions)
319341
.then(response => {
320-
if (!response.ok) {
342+
if (!response.ok) {
321343
throw new Error('Network response was not ok');
322344
}
323345
return response.json();
@@ -371,7 +393,15 @@ <h2 class="text-2xl mb-4">Stock Predictions</h2>
371393
fetch("http://localhost:8017/api/person/image/post", requestOptions)
372394
.then((response) => response.text())
373395
.then((result) => console.log(result))
396+
.then((blob) => {
397+
document.getElementById('pic').innerHTML = `<img id="profilePic" src="http://localhost:8017/api/person/image/${userEmail}" onerror="handleImageError()"/>`;
398+
}
399+
400+
)
374401
.catch((error) => console.error(error));
402+
403+
404+
375405
}
376406

377407
// function getProfilePicture() {
@@ -395,6 +425,6 @@ <h2 class="text-2xl mb-4">Stock Predictions</h2>
395425
document.addEventListener("DOMContentLoaded", function() {
396426
getStats();
397427
getName();
398-
getProfilePicture();
428+
// getProfilePicture();
399429
});
400430
</script>

0 commit comments

Comments
 (0)