1

I'm using HarmonyOs to create a (not lite) Wearable App. I want to use Axios to send requests to my server. I was able to install the package with npm install axios and import it on the page I want to use it.

The problem I'm facing is that the whole axios request seems to be ignored. Here is an example.

import axios from 'axios'

export default {
    onButtonClick() {
        console.log("AXIOS TEST")

        axios.get("https://example.com/test")
            .then(result => console.log("AXIOS result " + result))
            .catch(error => console.log("AXIOS error " + error))

        console.log("AXIOS TEST END")
    }
}

I get the AXIOS TEST and AXIOS TEST END logs when I click the button but neither the result nor error logs. Neither any other logs related to axios.

I believe I have the needed permissions and I tested this snippet in a node script and that worked fine.

Am I missing something or can someone please give me a hand?

Daniel
  • 611
  • 8
  • 20

1 Answers1

1

As relevant team confirmed, axios is not supported currently, but is being planned.

Therefore, you are advised to preferentially use fetch requests.

For more details,pls kindly refer Docs.

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
  • 1
    Thanks @shirley. Ill accept the answer for now. Hopefully I will be able to add another answer in the future where Axios is available. – Daniel Jun 17 '21 at 09:17