-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bbf1a57
commit c8e5c16
Showing
3 changed files
with
23 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,19 +46,27 @@ const ACCOUNT_EMAILS = { | |
product: "[email protected]", | ||
}; | ||
|
||
const createQuery = (email, password) => `mutation TokenAuth{ | ||
tokenCreate(email: "${email}", password: "${password}") { | ||
token | ||
refreshToken | ||
errors { | ||
code | ||
message | ||
const createQuery = (email, password) => { | ||
const query = ` | ||
mutation TokenAuth($email: String!, $password: String!) { | ||
tokenCreate(email: $email, password: $password) { | ||
token | ||
refreshToken | ||
errors { | ||
code | ||
message | ||
} | ||
user { | ||
id | ||
} | ||
} | ||
} | ||
user { | ||
id | ||
} | ||
} | ||
}`; | ||
` | ||
|
||
const variables = { email, password } | ||
|
||
return { query, variables } | ||
}; | ||
|
||
|
||
const getEmailForPermission = (permission) => { | ||
|
@@ -84,10 +92,9 @@ const getAuthForPermission = async (permissionName) => { | |
|
||
const email = getEmailForPermission(permissionName); | ||
const password = getPasswordForPermission(permissionName); | ||
const query = createQuery(email, password) | ||
|
||
const response = await apiRequestContext.post(process.env.API_URL || "", { | ||
data: { query }, | ||
data: createQuery(email, password), | ||
}); | ||
const resposnseObj = await response.json() | ||
const { errors } = resposnseObj.data.tokenCreate | ||
|