diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml new file mode 100644 index 000000000..ff71ac9c3 --- /dev/null +++ b/.github/workflows/codeql.yaml @@ -0,0 +1,49 @@ +name: "CodeQL" + +on: + pull_request: + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Use only 'java' to analyze code written in Java, Kotlin or both + # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + env: + ORG_GRADLE_PROJECT_githubUser: x-access-token + ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }} + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/src/common/api/axios/axios.ts b/src/common/api/axios/axios.ts index 9b692df63..3590fe643 100644 --- a/src/common/api/axios/axios.ts +++ b/src/common/api/axios/axios.ts @@ -76,6 +76,25 @@ export const get = ( }); }; +export const get2 = ( + url: string, + baseurl: string, + errorType: ErrorType, + options?: AxiosOptions +): Promise => { + return axios + .get(url, { + baseURL: baseurl, + headers: defaultRequestHeaders(options), + responseType: options?.responseType, + withCredentials: true, + }) + .then((response) => response.data) + .catch(function (error) { + handleError(error, errorType); + }); +}; + export const post = ( url: string, errorType: ErrorType, diff --git a/src/common/api/queries/arbeidsgiver/dialogmoteDataQueryAG.ts b/src/common/api/queries/arbeidsgiver/dialogmoteDataQueryAG.ts index 337beb7b6..2b0c322eb 100644 --- a/src/common/api/queries/arbeidsgiver/dialogmoteDataQueryAG.ts +++ b/src/common/api/queries/arbeidsgiver/dialogmoteDataQueryAG.ts @@ -1,5 +1,5 @@ import { useQuery } from "@tanstack/react-query"; -import { get } from "@/common/api/axios/axios"; +import { get2 } from "@/common/api/axios/axios"; import { useNarmesteLederId } from "@/common/hooks/useNarmesteLederId"; import { useApiBasePath } from "@/common/hooks/routeHooks"; import { DialogmoteData } from "types/shared/dialogmote"; @@ -11,8 +11,9 @@ export const useDialogmoteDataAG = () => { const apiBasePath = useApiBasePath(); const fetchDialogmoteData = () => - get( - `${apiBasePath}/${narmestelederid}`, + get2( + `/${narmestelederid}`, + apiBasePath, "fetchDialogmoteDataAGException" );