I used axios on Node js, but it doesn't work on certain phones (chrome)

Asked 1 years ago, Updated 1 years ago, 85 views

Hello! It's my first time to leave a message...

I'm not a developer, but I'm using NodeJS EJS to make a ticket system similar to a shopping mall.

To use the text transmission service, I received the aligoapi service, wrote the code below, and used it, but the text was sent normally on the web and Android phones, but it didn't work except for one out of five iPhones, so I kept testing it, but it didn't work, so I'm leaving a message ㅜ<

First of all, the code is as follows.

import aligoapi from 'aligoapi';

api.post('/smstransfer', (req, res) => {
    const { username, title, hall } = req.body;

    req.body = {
        sender: '01011112222',
        receiver: '01022223333',
        msg: '${username} has sent you a ${title} slip. - - ${hall}`
    }

    aligoapi.send(req, AuthData)
        .then(r => console.log(r)
        .catch(e => console.log(e));
});

Above is the api code and below is the front end. It is written in ejs.

<script>
$(document).ready(function () {
    $('#trans').click(function() {
        If (confirm() Do you want to send the slip?')) {
            var username = $('#username').val();
            var title = $('#title').val();
            var hall = $('#hall').val();

            axios.post('/smstransfer', { username, title, hall })
               .then(r => console.log(r))
                .catch(e => console.log(e));

            Varmsg = ' slip sent. Front desk verification is required';
            socket.emit("trans", msg);
        }
    });
});
</script>

After doing this, press the transfer button to activate it

Web: Normal operation
Android: Normal operation
iPhone: 1 unit normal operation (4 units not operation)

If you track the log, the log in the case of normal operation as shown below is

POST /checkout 200 15.086ms
GET /cart 200 9.444 ms
POST /smstransfer

It works while being filmed like this, but if you try an iPhone that doesn't work

POST /checkout 200 131.205 ms
GET /cart

In this way, the POST itself is completely ignored...

I tried hard to googling with short knowledge, but it was so hard to find this situation that Hemeida visited this place for about 3 days, so I am writing...

I asked the API provider, but the fact that it's only for certain phones is that they can't do anything about it unless they check the phone, so I compared the iPhone that works and the iPhone that doesn't work, but I don't know if there's any difference.

If you know anything suspicious, please leave a comment ㅜ<

node.js axios iphone

2022-09-22 18:42

1 Answers

Check out the link below.

https://stackoverflow.com/questions/57163186/axios-post-fails-on-ios


2022-09-22 18:42

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.