-
Notifications
You must be signed in to change notification settings - Fork 8
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 #732 from basedosdados/feat/user-page
Feat/user page
- Loading branch information
Showing
18 changed files
with
603 additions
and
231 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
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
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,45 @@ | ||
import axios from "axios"; | ||
|
||
const API_URL= `${process.env.NEXT_PUBLIC_API_URL}/api/v1/graphql` | ||
|
||
export default async function getFullUser(email) { | ||
try { | ||
const res = await axios({ | ||
url: API_URL, | ||
method: "POST", | ||
data: { | ||
query: ` | ||
query { | ||
allAccount (email : "${email}"){ | ||
edges { | ||
node { | ||
id | ||
isAdmin | ||
isActive | ||
isEmailVisible | ||
picture | ||
username | ||
firstName | ||
lastName | ||
website | ||
github | ||
proSubscription | ||
proSubscriptionRole | ||
proSubscriptionSlots | ||
proSubscriptionStatus | ||
} | ||
} | ||
} | ||
} | ||
` | ||
} | ||
}) | ||
const data = res.data?.data?.allAccount?.edges[0]?.node | ||
return data | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} |
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
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,56 @@ | ||
import axios from "axios"; | ||
import cookies from "js-cookie"; | ||
|
||
const API_URL= `${process.env.NEXT_PUBLIC_API_URL}/api/v1/graphql` | ||
|
||
export default async function updateProfile({ | ||
id, | ||
firstName, | ||
lastName = "", | ||
isEmailVisible = false, | ||
// picture, | ||
website = "", | ||
github = "", | ||
twitter = "", | ||
linkedin = "" | ||
}) { | ||
let token = cookies.get("token") || "" | ||
// picture: "${picture}" | ||
|
||
try { | ||
const res = await axios({ | ||
url: API_URL, | ||
method: "POST", | ||
headers: { | ||
Authorization: `Bearer ${token}` | ||
}, | ||
data: { | ||
query: ` | ||
mutation { | ||
CreateUpdateAccount (input: | ||
{ | ||
id: "${id}" | ||
firstName: "${firstName}" | ||
lastName: "${lastName}" | ||
isEmailVisible: ${isEmailVisible} | ||
website: "${website}" | ||
github: "${github}" | ||
twitter: "${twitter}" | ||
linkedin: "${linkedin}" | ||
} | ||
) | ||
{ | ||
errors { | ||
field, | ||
messages | ||
} | ||
} | ||
}` | ||
} | ||
}) | ||
const data = res.data.data.CreateUpdateAccount | ||
return data | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} |
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,44 @@ | ||
import axios from "axios"; | ||
import cookies from "js-cookie"; | ||
|
||
const API_URL= `${process.env.NEXT_PUBLIC_API_URL}/api/v1/graphql` | ||
|
||
export default async function updateUser({ | ||
id, | ||
email, | ||
username, | ||
}) { | ||
let token = cookies.get("token") || "" | ||
|
||
try { | ||
const res = await axios({ | ||
url: API_URL, | ||
method: "POST", | ||
headers: { | ||
Authorization: `Bearer ${token}` | ||
}, | ||
data: { | ||
query: ` | ||
mutation { | ||
CreateUpdateAccount (input: | ||
{ | ||
id: "${id}" | ||
email: "${email}" | ||
username: "${username}" | ||
} | ||
) | ||
{ | ||
errors { | ||
field, | ||
messages | ||
} | ||
} | ||
}` | ||
} | ||
}) | ||
const data = res.data.data.CreateUpdateAccount | ||
return data | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} |
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
Oops, something went wrong.