# Rewrite into Nocode

**URL:** <https://community.weweb.io/t/rewrite-into-nocode/4077>\
**Category:** How do I?\
**Tags:** authentication\
**Created:** [August 28, 2023, 11:09pm UTC](https://community.weweb.io/t/rewrite-into-nocode/4077 "2023-08-28T23:09:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisb](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/chrisb/32/2834_2.png) [@chrisb](https://community.weweb.io/u/chrisb)\
**Post date:** [August 28, 2023, 11:09pm UTC](https://community.weweb.io/t/rewrite-into-nocode/4077/1 "2023-08-28T23:09:07Z")

</div>

My backend dev person wrote this javascript for my login page. It works, but I wanted to see if this could be rewritten in weweb no code. My backend system uses GraphQL, thus the mutation references.

```auto
const username = variables[/* Email Input - value */ '92cf57d9-136f-459e-8f82-796b245b8ae3-value'];
 const password = variables[/* Password Input - value */ '9342cd38-107f-4602-bd80-749d66c52490-value'];

    const loginMutation = `
  mutation LoginUser($username: String!, $password: String!, $rememberMe: Boolean) {
    login(username:$username password: $password, rememberMe: $rememberMe) {
      __typename
      ... on CurrentUser {
        id
        identifier
        refreshToken
      }
    }
  }

    `;

    const variableData = {
      username,
      password,
    };

    const response = await axios.post('https://provider.modwalla.com/shop-api', {
      query: loginMutation,
      variables: variableData,
    });
    
    const loginResult = response.data.data.login;

return {
loginResult,
headers: response.headers
}

```

---

<div class="post-metadata">

**Author:** ![aurelie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/aurelie/32/13249_2.png) [@aurelie](https://community.weweb.io/u/aurelie)\
**Post date:** [August 29, 2023, 11:29am UTC](https://community.weweb.io/t/rewrite-into-nocode/4077/2 "2023-08-29T11:29:42Z")

</div>

Hey,  
thats totally doable in NoCode.  
You can create a string/text variable containing your loginMutation  
Then add the Rest API plugin.

Then on your workflow, you can have a REST API Request action, using a POST action, and two fields: one named query with your loginMutation varaible, and one names variables with an Object containing your username and password.

You can then access the result with result.data.login and put it inside a variable.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/3/342df971d0e6ff713797dfcab3930298c1d4348c.png)
