Skip to content

Commit 7d782a4

Browse files
committed
Use aync/await pattern for axios
1 parent c1c8f6f commit 7d782a4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

renderer.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ function selectWhyUsBtn() {
6464
}
6565

6666
async function uploadApiKey() {
67-
axios.post(`${SERVER_URL}/apikey`, { 'OPENAI_API_KEY': API_KEY_INFO })
68-
.then((response) => {
67+
try {
68+
let response = await axios.post(`${SERVER_URL}/apikey`, { 'OPENAI_API_KEY': API_KEY_INFO });
6969
console.log(response.data);
70-
})
71-
.catch((error) => {
72-
console.error(error);
73-
});
70+
} catch (e) {
71+
console.log(e);
72+
alert(e);
73+
}
7474
}
7575

7676
async function uploadResume(event) {

0 commit comments

Comments
 (0)