-
Notifications
You must be signed in to change notification settings - Fork 0
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 #11 from OpenPecha/userprofile
Userprofile - add and edit
- Loading branch information
Showing
8 changed files
with
642 additions
and
34 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,52 +1,28 @@ | ||
import React from "react"; | ||
import "./UserProfile.scss"; | ||
import { useAuth0 } from "@auth0/auth0-react"; | ||
import { Card } from "react-bootstrap"; | ||
import { Link } from "react-router-dom"; | ||
import { useTranslation } from "react-i18next"; | ||
import PechaUserProfile from "./pecha-user-profile/PechaUserProfile.jsx"; | ||
import {useQuery} from "react-query"; | ||
import axiosInstance from "../config/axios-config.js"; | ||
|
||
function UserProfile() { | ||
const {user, isAuthenticated} = useAuth0(); | ||
const {t} = useTranslation(); | ||
|
||
console.log(user); | ||
const userInfo = useQuery("userInfo",async () => { | ||
return await axiosInstance.get("/api/v1/users/info"); | ||
}) | ||
console.log(userInfo) | ||
|
||
function renderProfileViaSocialLogin() { | ||
return ( | ||
<Card className="profile-card"> | ||
<Card.Body> | ||
<div className="profile-header"> | ||
<img src={user.picture} alt={`${user.name}'s profile`} className="profile-picture"/> | ||
<h2>{user.given_name} {user.family_name}</h2> | ||
<h5>Nickname: {user.nickname}</h5> | ||
</div> | ||
<Card.Text> | ||
<strong>Email:</strong> {user.email}<br/> | ||
<strong>Email Verified:</strong> {user.email_verified ? 'Yes' : 'No'}<br/> | ||
<strong>Last Updated:</strong> {new Date(user.updated_at).toLocaleString()}<br/> | ||
<Link to="/reset-password" className="reset-password"> | ||
{t("resetPassword")} | ||
</Link> | ||
</Card.Text> | ||
</Card.Body> | ||
</Card> | ||
<PechaUserProfile userInfo ={user}/> | ||
) | ||
} | ||
|
||
function renderProfileViaPechaLogin(){ | ||
function renderProfileViaPechaLogin() { | ||
return ( | ||
<Card className="profile-card"> | ||
<Card.Body> | ||
<div className="profile-header"> | ||
<img className="profile-picture" /> | ||
<h2>To be implemented</h2> | ||
</div> | ||
<Card.Text> | ||
<strong>Email:</strong>[email protected]<br /> | ||
|
||
</Card.Text> | ||
</Card.Body> | ||
</Card> | ||
<PechaUserProfile userInfo = {user}/> | ||
) | ||
} | ||
|
||
|
Oops, something went wrong.