0

Electron と Axios を使用して http リクエストを作成するシンプルなアプリを作成しています。しかし、サーバーに投稿リクエストを送信しようとするたびに、Chrome Devtools で確認できるように取得リクエストしか作成されません。ここで何が起こっているのか理解できません。

サーバー側には、POST リクエストのみを受け入れる Laravel バックエンド アプリがあります。

ここに画像の説明を入力

index.html

<html>
    <body>
        <script src="axios.min.js"></script>
        <script>
            axios.post('https://www.example.com/api/users/', {
                firstName: 'Fred',
                lastName: 'Flintstone'
            })
        </script>
    </body>
</html>

main.js

const { app, BrowserWindow } = require('electron')

let win

function createWindow () {
  win = new BrowserWindow({
    width: 530,
    height: 520,
    webPreferences: {
        nodeIntegration: true
    },
  })

  win.loadFile('index.html')
  win.setAlwaysOnTop(true)

  win.on('closed', () => {
    win = null
  })
}

app.on('ready', createWindow)

app.on('window-all-closed', () => {
    app.quit()
})
4

1 に答える 1