Skip to content

Commit

Permalink
header fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hburn7 committed Oct 29, 2023
1 parent d0e53f9 commit d657fdf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/LinkSubmissionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@ function LinkSubmissionForm({
setRankRangeLowerBound(null);
setGameMode(0);

const origin = process.env.REACT_APP_ORIGIN_URL;

fetch(apiLink + "/osumatches/batch?verified=" + isSubmissionVerified, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Origin": `${origin}`,
},
credentials: "include",
body: JSON.stringify({
Expand Down
3 changes: 2 additions & 1 deletion src/components/pages/Auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function Auth({ isAuthenticated, setIsAuthenticated, setAuthenticatedUser }: IAu
const navigate = useNavigate();

const apiLink = process.env.REACT_APP_API_URL;
const origin = process.env.REACT_APP_ORIGIN_URL;

useEffect(() => {
console.log("Logging in after osu! redirect");
Expand All @@ -17,7 +18,7 @@ function Auth({ isAuthenticated, setIsAuthenticated, setAuthenticatedUser }: IAu
method: "POST",
headers: {
"Content-Type": "application/json",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Origin": `${origin}`,
},
credentials: "include",
})
Expand Down
5 changes: 5 additions & 0 deletions src/components/pages/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ function Dashboard({ isAuthenticated, mode }: { isAuthenticated: boolean, mode:
date.setDate(date.getDate() - historyDays);
const formattedDate = date.toISOString().split("T")[0];

const origin = process.env.REACT_APP_ORIGIN_URL;
fetch(apiLink + "/me/stats?dateMin=" + formattedDate + "&mode=" + mode, {
method: "GET",
headers: {
"Content-Type": "application/json",
"Access-Control-Allow-Origin": `${origin}`,
},
credentials: "include",
})
.then((response) => response.json())
Expand Down
2 changes: 2 additions & 0 deletions src/components/pages/Leaderboards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function Leaderboards({ mode }: { mode: number }) {
const [isLoading, setIsLoading] = useState(false);

const apiUrl = process.env.REACT_APP_API_URL;
const origin = process.env.REACT_APP_ORIGIN_URL;

useEffect(() => {
setIsLoading(true);
Expand All @@ -25,6 +26,7 @@ function Leaderboards({ mode }: { mode: number }) {
method: "GET",
headers: {
"Content-Type": "application/json",
"Access-Control-Allow-Origin": `${origin}`
},
}
)
Expand Down

0 comments on commit d657fdf

Please sign in to comment.