Fixed download category
This commit is contained in:
@@ -29,7 +29,7 @@ const SignsPage: React.FC = () => {
|
||||
};
|
||||
|
||||
const handleDownloadData = async () => {
|
||||
downloadSigns().then((blob: Blob) => {
|
||||
downloadSigns(id!).then((blob: Blob) => {
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
|
||||
@@ -51,11 +51,11 @@ const getSign = async (id: number) => {
|
||||
return response.json();
|
||||
};
|
||||
|
||||
const downloadSigns = async () => {
|
||||
const downloadSigns = async (category: string) => {
|
||||
// get access token from local storage
|
||||
const token = localStorage.getItem('accessToken');
|
||||
// make request to download signs
|
||||
const response = await fetch(`${process.env.REACT_APP_API_URL}/signs/download/all`, {
|
||||
const response = await fetch(`${process.env.REACT_APP_API_URL}/categories/${category}/download`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user