Skip to content

Commit

Permalink
adding authorization to file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Alana Tran authored and Alana Tran committed Feb 9, 2022
1 parent 3b844f2 commit 7f8bbc9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion web/src/components/map/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import axios from "axios";

import { getAccessToken } from "../auth/utils";
import { apiUrlCollectionById, apiUrlCollections } from "../../api.util";

/**
Expand Down Expand Up @@ -64,6 +64,9 @@ export const getPollutantsByCollectionId = async (
cancelTokenSource
) => {
const options = {
headers: {
Authorization: `JWT ${getAccessToken()}`
},
cancelToken: cancelTokenSource.token,
};
try {
Expand Down Expand Up @@ -116,6 +119,9 @@ export const getCollectionsOnDate = async (
cancelTokenSource
) => {
const options = {
headers: {
Authorization: `JWT ${getAccessToken()}`
},
params: {
start_date: formattedDate,
},
Expand Down Expand Up @@ -147,6 +153,9 @@ export const getCollectionsOnDate = async (
*/
export const getCollectionFileByLink = async (fileLink, cancelTokenSource) => {
const options = {
headers: {
Authorization: `JWT ${getAccessToken()}`
},
cancelToken: cancelTokenSource.token,
};
try {
Expand Down

0 comments on commit 7f8bbc9

Please sign in to comment.