Hello everyone. The essence of the project: There is a bot in Telegram through which registration takes place and everything else. There is also a CRM system, which must be entered through Telegram. I'm using Vue 3, Express, mysql2

  1. In the form on CRM, enter the number to which the code is sent in Telegram.
  2. The generated code is entered into the database and the fact that it has already been sent.
  3. Enter the Telegram code into the second field in CRM and the user is authorized.

Request code from CRM to back:

methods: {
async sendCode () {
  await axios.put (`http: //localhost: 9000 /login /$ {this.number}`);

Database request code:

export const sendCodes= (id, result)= >
    db.query ("UPDATE users SET CodeIsSend= 1 WHERE id=?", [id], (err, results)= >
        if (err) {
            console.log (err);
            result (err, null);
        } else {
            result (null, results);

Back throws an error:val.slice is not a function

If you need more information, I will provide it as quickly as possible.

And where is the line val.slice in the above code?

Алексей Шиманский2021-10-31 08:19:51

while ((match= CHARS_GLOBAL_REGEXP.exec (val))) {escapedVal += val.slice (chunkIndex, match.index) + CHARS_ESCAPE_MAP [match [0]]; chunkIndex= CHARS_GLOBAL_REGEXP.lastIndex; }

Павел Саенко2021-10-31 08:23:51

what is val?

Алексей Шиманский2021-10-31 08:28:49

This is due to the functionality of the npmjs.com/package/sqlstring library. It seems to me that I have tricked me somewhere with the passed parameters. There is an option to pass the number not through the url, I think it would be perfect.

Павел Саенко2021-10-31 08:32:40