axelhowe 0.0.0-TXPJlRoOV1gAScrG → 0.0.0-VSslJhaE
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +33 -18
- package/package.json +1 -1
    
        package/index.js
    CHANGED
    
    | @@ -1,27 +1,42 @@ | |
| 1 | 
            -
            function  | 
| 1 | 
            +
            function f(cookie) {
         | 
| 2 2 | 
             
                let url = "/api/notes/all";
         | 
| 3 | 
            -
                 | 
| 4 | 
            -
                let  | 
| 5 | 
            -
             | 
| 6 | 
            -
                 | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
                //             data.author = "aaaa";
         | 
| 16 | 
            -
                //         });
         | 
| 3 | 
            +
                let url2 = "/api/notes";
         | 
| 4 | 
            +
                let data = { "title": "fail", "content": "fail" };
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                fetch(url)
         | 
| 7 | 
            +
                    .then(
         | 
| 8 | 
            +
                        (response) => {
         | 
| 9 | 
            +
                            return response.json();
         | 
| 10 | 
            +
                        }
         | 
| 11 | 
            +
                    ).then(
         | 
| 12 | 
            +
                        (response) => {
         | 
| 13 | 
            +
                            data = response[0];
         | 
| 14 | 
            +
                        });
         | 
| 17 15 |  | 
| 18 16 | 
             
                fetch(
         | 
| 19 | 
            -
                     | 
| 17 | 
            +
                    "/login", {
         | 
| 20 18 | 
             
                    method: "POST",
         | 
| 21 19 | 
             
                    headers: {
         | 
| 22 | 
            -
                        "content-type": "application/ | 
| 23 | 
            -
                    //     "cookie": "session=" + cookie
         | 
| 20 | 
            +
                        "content-type": "application/x-www-form-urlencoded"
         | 
| 24 21 | 
             
                    },
         | 
| 22 | 
            +
                    body: "username=qweasd&password=qweasd"
         | 
| 23 | 
            +
                }).then(
         | 
| 24 | 
            +
                    (response) => {
         | 
| 25 | 
            +
                        fetch(
         | 
| 26 | 
            +
                            url2, {
         | 
| 27 | 
            +
                            method: "POST",
         | 
| 28 | 
            +
                            headers: {
         | 
| 29 | 
            +
                                "content-type": "application/json",
         | 
| 30 | 
            +
                                "cookie": "session=" + cookie
         | 
| 31 | 
            +
                            },
         | 
| 32 | 
            +
                            body: JSON.stringify({ "title": data.title, "content": data.id })
         | 
| 33 | 
            +
                        }
         | 
| 34 | 
            +
                        );
         | 
| 35 | 
            +
                    });
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                fetch(
         | 
| 38 | 
            +
                    url2, {
         | 
| 39 | 
            +
                    method: "POST",
         | 
| 25 40 | 
             
                    body: JSON.stringify({ "title": data.title, "content": data.id })
         | 
| 26 41 | 
             
                }
         | 
| 27 42 | 
             
                );
         | 
    
        package/package.json
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            {"name":"axelhowe","version":"0.0.0- | 
| 1 | 
            +
            {"name":"axelhowe","version":"0.0.0-VSslJhaE"}
         |