Skip to content

Commit

Permalink
cors 2
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadshahidbeigh committed Oct 20, 2024
1 parent 01a724c commit b87d1aa
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import {
} from "@mui/material";
import {Brightness4, Brightness7} from "@mui/icons-material";

const backendUrl = "http://43.205.10.7:4000/graphql"; // Update this to the EC2's public IP

// Create an Apollo Link to set the authorization header
const authLink = new ApolloLink((operation, forward) => {
const token = localStorage.getItem("jwtToken"); // Assuming the token is stored in localStorage
Expand All @@ -38,10 +40,7 @@ const authLink = new ApolloLink((operation, forward) => {

// Create the Apollo Client
const client = new ApolloClient({
link: ApolloLink.from([
authLink,
new HttpLink({uri: "http://localhost:4000/graphql"}), // Replace with your GraphQL API URL
]),
link: ApolloLink.from([authLink, new HttpLink({uri: backendUrl})]),
cache: new InMemoryCache(),
});

Expand Down

0 comments on commit b87d1aa

Please sign in to comment.