Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/src/api/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ type GraphQLResponse<T> = {
errors?: GraphQLError[];
};

import { GRAPHQL_URL } from "./graphqlUrl";

/**
* Hva gjør dette? Trenger vi det hvis vi har apollo client?
*/
const GRAPHQL_URL = import.meta.env.VITE_GRAPHQL_URL ?? "http://localhost:3001/";

export async function graphqlRequest<T>(
query: string,
variables?: Record<string, unknown>,
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/api/graphqlUrl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const defaultGraphqlUrl = import.meta.env.DEV
? "http://localhost:3001/"
: `${window.location.protocol}//${window.location.hostname}:3001/`;

export const GRAPHQL_URL = import.meta.env.VITE_GRAPHQL_URL || defaultGraphqlUrl;
3 changes: 2 additions & 1 deletion frontend/src/apollo/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import {
InMemoryCache,
HttpLink,
} from "@apollo/client";
import { GRAPHQL_URL } from "../api/graphqlUrl";

export const apolloClient =
new ApolloClient({
link: new HttpLink({
uri: "http://localhost:3001",
uri: GRAPHQL_URL,
}),
cache: new InMemoryCache(),
});
4 changes: 2 additions & 2 deletions frontend/src/pages/ThreatActors/ThreatActorDetailed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function ThreatActorDetailed() {
);

//Henter ut Assosierte Techniques
const {data: techniquesData, loading: techniquesLoading, error: techniquesError} = useQuery(GET_THREAT_ACTOR_TECHNIQUES, {
const {data: techniquesData} = useQuery(GET_THREAT_ACTOR_TECHNIQUES, {
variables: {
mitreId: mitreId ?? "",
limit: PAGE_SIZE,
Expand All @@ -40,7 +40,7 @@ function ThreatActorDetailed() {
});

//Henter ut Assosierte Softwares
const {data: softwaresData, loading: softwaresLoading, error: softwaresError} = useQuery(GET_THREAT_ACTOR_SOFTWARES, {
const {data: softwaresData} = useQuery(GET_THREAT_ACTOR_SOFTWARES, {
variables: {
mitreId: mitreId ?? "",
limit: PAGE_SIZE,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/ThreatActors/ThreatActors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function ThreatActor(){
const pageSize = 9;
const [page, setPage] = useState(1);

const {data, loading, error} = useQuery(GET_ALL_THREAT_ACTOR_GRID, {
const {data} = useQuery(GET_ALL_THREAT_ACTOR_GRID, {
variables: {
limit: pageSize,
offset: (page - 1) * pageSize
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import TechniqueDetailed from "../pages/Techniques/TechniqueDetailed";
*/
function AppRoutes() {
return (
<BrowserRouter basename="/project2">
<BrowserRouter basename={import.meta.env.DEV ? "/" : "/project2"}>
<Routes>
<Route element={<AppLayout />}>
<Route path="/" element={<Home />} />
Expand Down