-
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.
ajust all userInfo, fix update user info
- Loading branch information
1 parent
a25aa99
commit 5084e6e
Showing
9 changed files
with
352 additions
and
213 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
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
Oops, something went wrong.