66b0151d by Ian Rizh Mañago

Merge branch '28225_not_loading' of https://gitlab.baytech.ph/baytech/chatgpt.ai-pro.org into 1DEVT

2 parents e7c86cd9 452ab7ca
...@@ -26,32 +26,11 @@ ...@@ -26,32 +26,11 @@
26 Learn how to configure a non-root public URL by running `npm run build`. 26 Learn how to configure a non-root public URL by running `npm run build`.
27 --> 27 -->
28 <title>AI-Pro ChatGPT</title> 28 <title>AI-Pro ChatGPT</title>
29 <script src='%REACT_APP_BTCOMPONENT_S3_URL%/common/btutil-authenticate.min.js'></script>
30 <script> 29 <script>
31 let aiUser = btutil_getCookie('aiwp_logged_in'); 30 let ver = new Date().getTime();
32 if(!aiUser) { 31 let btutilAsset = document.createElement('script');
33 window.location.href = '%REACT_APP_AUTH_FAILED_REDIRECTION_URL%'; 32 btutilAsset.setAttribute('src', "%REACT_APP_BTUTIL_ASSET_URL%" + ver);
34 } else { 33 document.head.appendChild(btutilAsset);
35 let objBody = { aiwp_logged_in: aiUser };
36
37 let params = [];
38 params['objBody'] = objBody;
39 params['strUrl'] = '%REACT_APP_EXTERNAL_API_URL%/e/v1/authenticate/';
40
41 btutil_checkAuthentication(params, cbCheckAuthentication, cbErrCheckAuthentication);
42 function cbCheckAuthentication(res) {
43 // console.log(res);
44 if (!res.success) {
45 window.location.href = '%REACT_APP_AUTH_FAILED_REDIRECTION_URL%';
46 } else {
47 document.getElementById("root").classList.add("active");
48 }
49 }
50
51 function cbErrCheckAuthentication(res) {
52 console.log(res);
53 }
54 }
55 </script> 34 </script>
56 </head> 35 </head>
57 <body> 36 <body>
......
...@@ -56,26 +56,7 @@ function App() { ...@@ -56,26 +56,7 @@ function App() {
56 } 56 }
57 57
58 async function handleSubmit(e){ 58 async function handleSubmit(e){
59 e.preventDefault(); 59 submitPrompt();
60 let aiUser = window.btutil_getCookie('aiwp_logged_in');
61 if(!aiUser) {
62 window.location.href = process.env.REACT_APP_AUTH_FAILED_REDIRECTION_URL;
63 return;
64 } else {
65 let objBody = { aiwp_logged_in: aiUser };
66
67 let params = [];
68 params['objBody'] = objBody;
69 params['strUrl'] = process.env.REACT_APP_EXTERNAL_API_URL + '/e/v1/authenticate/';
70
71 window.btutil_checkAuthentication(params, function(res) {
72 if (!res.success) {
73 window.location.href = process.env.REACT_APP_AUTH_FAILED_REDIRECTION_URL;
74 } else {
75 submitPrompt();
76 }
77 }, function(res) {});
78 }
79 } 60 }
80 61
81 async function submitPrompt() { 62 async function submitPrompt() {
......
...@@ -10,8 +10,4 @@ body { ...@@ -10,8 +10,4 @@ body {
10 code { 10 code {
11 font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 11 font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 monospace; 12 monospace;
13 }
14
15 #root:not(.active) {
16 display: none;
17 } 13 }
...\ No newline at end of file ...\ No newline at end of file
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!