Skip to content

Commit

Permalink
refactor(UserAvatar): replace axios with fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesprague committed Jan 7, 2025
1 parent 1bdb2d0 commit 57ced68
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions app/components/UserAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
faRightFromBracket,
} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import axios from 'axios';
import clsx from 'clsx';
import { atom, useAtom } from 'jotai';
import { atomWithStorage } from 'jotai/utils';
Expand All @@ -27,15 +26,15 @@ export const UserAvatar = memo(() => {
return;
}
const getUserMeta = async () => {
await axios
.get('/.auth/me', {
headers: {
'Cache-Control': 'no-cache',
Pragma: 'no-cache',
Expires: '0',
},
})
.then((response) => {
await fetch('/.auth/me', {
headers: {
'Cache-Control': 'no-cache',
Pragma: 'no-cache',
Expires: '0',
},
})
.then(async (resp) => {
const response = await resp.json();
const email = response?.data[0]?.user_claims.find(
(item) => item.typ === 'preferred_username'
).val;
Expand Down

0 comments on commit 57ced68

Please sign in to comment.