Skip to content

Commit 1bdb2d0

Browse files
committed
refactor(UpdateCheck): replace axios with fetch
1 parent 4f3d9a2 commit 1bdb2d0

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

app/components/UpdateCheck.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { faCircleArrowUp } from '@fortawesome/free-solid-svg-icons';
22
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3-
import axios from 'axios';
43
import dayjs from 'dayjs';
54
import timezone from 'dayjs/plugin/timezone';
65
import utc from 'dayjs/plugin/utc';
@@ -25,21 +24,20 @@ export const UpdateCheck = () => {
2524
org = 'cu-cit-cloud-team',
2625
repo = 'azure-openai-gpt4-chat'
2726
) => {
28-
const latest = await axios
29-
.get(`https://api.github.com/repos/${org}/${repo}/releases/latest`)
30-
.then((response) => {
31-
const version = response.data.tag_name;
32-
const published = response.data.published_at;
33-
27+
const latest = await fetch(
28+
`https://api.github.com/repos/${org}/${repo}/releases/latest`
29+
)
30+
.then(async (response) => {
31+
const data = await response.json();
32+
const { version, published } = data;
3433
return {
3534
version,
3635
published,
3736
};
3837
})
39-
// biome-ignore lint/correctness/noUnusedVariables: used for debugging
4038
.catch((error) => {
4139
setUpdateAvailable(false);
42-
// console.error(error);
40+
console.error(error);
4341
});
4442

4543
setUpdateAvailable(

0 commit comments

Comments
 (0)