-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from Cavdy/ft-admin-and-staffs-can-view-users…
…-165661767 #165661767 Admin and staffs can view users
- Loading branch information
Showing
7 changed files
with
209 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const api = 'https://bankaapp-api.herokuapp.com/api/v1'; | ||
const token = sessionStorage.getItem('token'); | ||
const id = sessionStorage.getItem('id'); | ||
const profileSection = document.querySelector('.profile-section'); | ||
const firstname = document.querySelector('.firstname'); | ||
const lastname = document.querySelector('.lastname'); | ||
const email = document.querySelector('.email'); | ||
const type = document.querySelector('.type'); | ||
const admin = document.querySelector('.admin'); | ||
|
||
// GET FETCH API REQUEST TO GET A PARTICULAR ACCOUNT INFO | ||
const getAccountApi = (url) => { | ||
fetch(url, { | ||
method: 'GET', | ||
mode: 'cors', | ||
cache: 'no-cache', | ||
credentials: 'same-origin', | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
'Content-Type': 'application/json', | ||
}, | ||
redirect: 'follow', | ||
referrer: 'no-referrer', | ||
}) | ||
.then((response) => { | ||
if (response.status === 403) { | ||
profileSection.style.display = 'none'; | ||
} | ||
profileSection.style.display = 'flex'; | ||
return response.json(); | ||
}) | ||
.then((data1) => { | ||
const i = data1.data; | ||
firstname.innerHTML = i.firstname; | ||
lastname.innerHTML = i.lastname; | ||
email.innerHTML = i.email; | ||
type.innerHTML = i.type; | ||
admin.innerHTML = i.isadmin; | ||
}); | ||
}; | ||
|
||
getAccountApi(`${api}/users/${id}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Profile - Banka App</title> | ||
<link rel="stylesheet" href="./css/style.css"> | ||
|
||
</head> | ||
|
||
<body class="body"> | ||
<div class="profile-container"> | ||
<div class="profile"> | ||
<div class="profile-menu"> | ||
<a href="./dashboard.html" class="goback"> | ||
<svg class="goback-icon"> | ||
<use xlink:href="./svg/sprite.svg#icon-arrow-left2"></use> | ||
</svg></a></a> | ||
<a href="#" class="edit-profile">Edit</a> | ||
</div> | ||
<div class="profile-section"> | ||
<div class="left-profile-section"> | ||
<img src="./img/js2.png" alt="" class="profile-img"> | ||
</div> | ||
<div class="right-profile-section"> | ||
<h1>User Profile</h1> | ||
<div class="name"> | ||
<strong>First Name:</strong> <br> | ||
<span class="firstname"></span></div> | ||
<div class="name"> | ||
<strong>Last Name:</strong> <br> | ||
<span class="lastname"></span></div> | ||
<div class="name"> | ||
<strong>Email:</strong> <br> | ||
<span class="email"></span></div> | ||
<div class="name"> | ||
<strong>Type:</strong> <br> | ||
<span class="type"></span></div> | ||
<div class="name"> | ||
<strong>Admin:</strong> <br> | ||
<span class="admin"></span></div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<script src="./js/profile.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters