I'm currently working on creating a .js file that includes some async calls. I've got everything set up in the file, but when I try to call my method, I'm not seeing any results. It's a new process for me to call from a .js file, so I'm unsure of what mistakes I might be making.
Below is the content of my inventory.js file:
import axios from "axios";
let getInventories = async () => {
const result = await axios
.get("/inventories")
.catch((error) => console.log(error));
}
export {getInventories}
And here's the call from my Inventory.vue file:
import axios from "axios";
import { bus } from "../app";
import {getInventories} from './inventory';
export default {
mounted() {
let temp = getInventories();
debugger;
},
}
The variable 'temp' isn't returning anything. I tried adding an 'await' in front of getInventories
but encountered an error.