Skip to content

Commit

Permalink
Merge pull request #87 from Evavic44/add_profile_link
Browse files Browse the repository at this point in the history
🐞 Add profile link to endosers in skills section
  • Loading branch information
SpiffGreen authored Aug 3, 2022
2 parents 884db23 + efe6530 commit daabdeb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/pages/[username]/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const Skill = (props) => {
<>
<div className={styles.endorseImage}>
{props.detail.endorsements.map((endorser) => (
<a href="spekin.vercel.app" key={endorser.endorsers.id}>
<a href={endorser.endorsers.Profile[0].username} key={endorser.endorsers.id}>
<Image
src={endorser.endorsers.image}
width="40px"
Expand Down Expand Up @@ -176,14 +176,16 @@ function Endorsement(props) {
</p>
</div>
<div className={styles.endorsements}>
{skills.map((skill) => (
{skills.map((skill) => {
return (
<Skill
key={skill.id}
detail={skill}
userId={props.profile.userId}
userSession={session}
/>
))}
)
})}
</div>
</section>
</div>
Expand Down
16 changes: 14 additions & 2 deletions src/pages/api/users/skills.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,22 @@ export default async function handler(req, res) {
if (req.method === "GET") {
// Get skills
try {
const skills = await prisma.skill.findMany({ where: { userId: u_id }, select: { userId: false, id: true, skillName: true, endorsements: { include: { endorsers: true }} } });
const skills = await prisma.skill.findMany({
where: { userId: u_id }, select: {
userId: false, id: true, skillName: true, endorsements: {
include: {
endorsers: {
include: {
Profile: true
}
}
}
}
}
});
return res.json({ success: true, skills });
} catch (error) {
// console.log(error);
console.log(error);
return res.send("Server Error");
}
}
Expand Down

1 comment on commit daabdeb

@vercel
Copy link

@vercel vercel bot commented on daabdeb Aug 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.