Skip to content

Commit

Permalink
fix login by API (#1699)
Browse files Browse the repository at this point in the history
  • Loading branch information
karola312 authored Dec 17, 2021
1 parent be9e2ef commit 2de639b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cypress/support/customCommands/user/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Cypress.Commands.add(
const mutation = `mutation TokenAuth{
tokenCreate(email: "${user.email}", password: "${user.password}") {
token
csrfToken
refreshToken
errors: accountErrors {
code
field
Expand All @@ -32,6 +34,10 @@ Cypress.Commands.add(
}
}`;
return cy.sendRequestWithQuery(mutation, authorization).then(resp => {
window.localStorage.setItem(
"_saleorCSRFToken",
resp.body.data.tokenCreate.csrfToken
);
window.sessionStorage.setItem(
authorization,
resp.body.data.tokenCreate.token
Expand Down

0 comments on commit 2de639b

Please sign in to comment.