diff --git a/src/components/Footer.js b/src/components/Footer.js
index 0b33027..92a0f91 100644
--- a/src/components/Footer.js
+++ b/src/components/Footer.js
@@ -32,7 +32,7 @@ const Footer = () => {
git
- v0.0.8
+ v0.0.10
)}
{
diff --git a/src/components/Navigations/MainNavigation.js b/src/components/Navigations/MainNavigation.js
index 5c0327c..5a6ee0b 100644
--- a/src/components/Navigations/MainNavigation.js
+++ b/src/components/Navigations/MainNavigation.js
@@ -1,10 +1,54 @@
-import React, { useContext } from "react";
+import React, {useContext, useState} from "react";
import { Link } from "react-router-dom";
import { AuthContext } from "../../AuthProvider";
import "bulma/css/bulma.min.css";
+import {useConfig} from "../../ConfigProvider";
const MainNavigation = () => {
const { user, login, logout } = useContext(AuthContext);
+ const config = useConfig();
+ const [isDropdownOpen, setIsDropdownOpen] = useState(false);
+ if (config===undefined) {
+ return Loading ...
;
+ }
+ const handleGetBackup = async () => {
+ try{
+ const response = await fetch(
+ `${config.BACKEND_HOST}/api/backup/`, {
+ method: "GET",
+ headers: {
+ Authorization: `Bearer ${localStorage.getItem("accessToken")}`,
+ }
+ }
+ );
+ if(response.ok){
+ const blob = await response.blob();
+ const url = window.URL.createObjectURL(blob);
+ const a = document.createElement("a");
+ const contentDisposition = response.headers.get("Content-Disposition");
+ let filename = "backup.zip";
+ console.log(response.headers);
+ console.log(contentDisposition);
+ if (contentDisposition) {
+ const match = contentDisposition.match(/filename="?([^"]+)"?/);
+ console.log(match);
+ if (match && match[1]) {
+ console.log(match[1]);
+ filename = match[1];
+ }
+ }
+ a.href = url;
+ a.download = filename;
+ a.click();
+ window.URL.revokeObjectURL(url);
+ }else{
+ alert("Failed to get backup");
+ }
+ } catch(err){
+ console.log(err);
+ alert("An error occurred while retrieving backup");
+ }
+ };
return (