Skip to content

Commit

Permalink
fix bearer header for file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
klandeck committed Apr 7, 2022
1 parent 1ddce04 commit 3ae6167
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ui/src/pages/Upload.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import React, { useContext, useState } from 'react'
import { Box, Container, makeStyles, Typography } from '@material-ui/core'
import CloudUploadIcon from '@material-ui/icons/CloudUpload'
import { AxiosRequestConfig } from 'axios'
import HttpService from '../openapi/HttpService'
import CustomButton from '../components/Button/CustomButton'
import { SnackbarContext } from '../context/Snackbar'
import { Translations } from '../utils/Translations'
import { CustomTexts } from '../utils/CustomTexts'
import AXIOS_CONFIG from '../openapi/axios-config'
import UserService from '../auth/UserService'

const rest = HttpService.getAxiosClient()

Expand Down Expand Up @@ -46,7 +49,11 @@ const FileUpload = (): JSX.Element => {
data.append('name', file.file.name)
data.append('file', file.file)
rest
.post('/api/sources', data, {})
.post('/api/sources', data, {
headers: {
Authorization: `Bearer ${UserService.getToken()}`,
},
})
.then((): void =>
openSnackbar(Translations.UPLOAD_SUCCESS, 'success')
)
Expand Down

0 comments on commit 3ae6167

Please sign in to comment.