Anasayfa
diff --git a/src/components/quotes/pages/Publish.jsx b/src/components/quotes/pages/Publish.jsx
index 9ba7a31..28d6ea6 100644
--- a/src/components/quotes/pages/Publish.jsx
+++ b/src/components/quotes/pages/Publish.jsx
@@ -1,9 +1,21 @@
-import React, { useState } from 'react'
+import React, { useEffect, useState } from 'react'
import { FetchPOST } from '../../../middlewares/Fetch';
+import { checkLogin } from '../../../middlewares/logins/Check';
export default function Publish() {
const [books, setBooks] = useState([]);
const [selectedBook, setSelectedBook] = useState(null);
+ const [secure, setSecure] = useState(false);
+
+ useEffect(() => {
+ checkLogin().then(res => {
+ setSecure(res.secure);
+ });
+ },[secure]);
+
+ if(secure === false){
+ return(<>>);
+ };
return (
diff --git a/src/middlewares/GlobalStore.jsx b/src/middlewares/GlobalStore.jsx
index bf31023..61fb703 100644
--- a/src/middlewares/GlobalStore.jsx
+++ b/src/middlewares/GlobalStore.jsx
@@ -2,12 +2,17 @@ import { createContext, useContext, useEffect, useState } from 'react';
const GSContext = createContext();
-const GSProvider = ({ children, data, locales }) => {
- const [loading, setLoading] = useState(true);
+const GSProvider = ({ children }) => {
+ const [loading, setLoading] = useState(false);
+ const data = {
+ protocol: window.location.protocol,
+ back_end: "localhost:3001",
+ front_end: "localhost:3000"
+ };
if(loading === false){
return (
-
+
{children}
);
diff --git a/src/middlewares/logins/Check.jsx b/src/middlewares/logins/Check.jsx
new file mode 100644
index 0000000..a323566
--- /dev/null
+++ b/src/middlewares/logins/Check.jsx
@@ -0,0 +1,21 @@
+import { FetchPOST } from "../Fetch";
+
+export async function checkLogin() {
+ const data = {
+ secure: false
+ };
+
+ await FetchPOST({
+ port: 3001,
+ pathname: "/api/v1/logins/normal/verify"
+ }).then(res => {
+ if(res.Status = 200 && res.Token){
+ console.log(res);
+ data.secure = true;
+ }else{
+ data.secure = false;
+ };
+ });
+
+ return data;
+};
\ No newline at end of file