-
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 #733 from basedosdados/feat/user-page
wip password section in user page
- Loading branch information
Showing
5 changed files
with
154 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import axios from "axios"; | ||
|
||
const API_URL= `${process.env.NEXT_PUBLIC_API_URL}/api/v1/graphql` | ||
|
||
export default async function getSimpleToken({ email, password }) { | ||
try { | ||
const res = await axios({ | ||
url: API_URL, | ||
method: "POST", | ||
data: { | ||
query: ` | ||
mutation { | ||
tokenAuth ( email: "${email}", password: "${password}" ) { | ||
payload, | ||
refreshExpiresIn, | ||
token | ||
} | ||
}` | ||
} | ||
}) | ||
const data = res.data?.data | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import axios from "axios"; | ||
|
||
const API_URL= `${process.env.NEXT_PUBLIC_API_URL}/api/v1/graphql` | ||
|
||
export default async function updatePassword({ | ||
id, | ||
password, | ||
token | ||
}) { | ||
try { | ||
const res = await axios({ | ||
url: API_URL, | ||
method: "POST", | ||
headers: { | ||
Authorization: `Bearer ${token}` | ||
}, | ||
data: { | ||
query: ` | ||
mutation { | ||
CreateUpdateAccount (input: | ||
{ | ||
id: "${id}" | ||
password: "${password}" | ||
} | ||
) | ||
{ | ||
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