Gregniuki commited on
Commit
32c8e97
·
1 Parent(s): 8bd7b03

Update templates/register.html

Browse files
Files changed (1) hide show
  1. templates/register.html +20 -17
templates/register.html CHANGED
@@ -69,28 +69,31 @@
69
  // If fields are filled, form will proceed to submit
70
  // reCAPTCHA validation will be handled automatically by Google's script
71
  var formData = new FormData(this);
 
72
  fetch('/register', {
73
- method: 'POST',
74
- body: formData)
75
- })
76
- .then(response => response.json())
 
 
 
 
 
77
  .then(data => {
78
- // Here you can handle the received data, including the access token and redirect URL
79
- // For example:
80
- storeAccessToken(data.access_token);
81
- window.location.href = data.redirect_url;
82
- })
83
  .catch(error => {
84
- console.error('Error:', error);
85
- });
86
  });
 
87
 
88
-
89
- });
90
- function storeAccessToken(token) {
91
- // Implement your token storage logic here
92
- console.log("Token stored:", token);
93
- }
94
  </script>
95
  </body>
96
 
 
69
  // If fields are filled, form will proceed to submit
70
  // reCAPTCHA validation will be handled automatically by Google's script
71
  var formData = new FormData(this);
72
+
73
  fetch('/register', {
74
+ method: 'POST',
75
+ body: formData
76
+ })
77
+ .then(response => {
78
+ if (!response.ok) {
79
+ throw new Error('Network response was not ok ' + response.statusText);
80
+ }
81
+ return response.json();
82
+ })
83
  .then(data => {
84
+ // Handle the received data
85
+ storeAccessToken(data.access_token);
86
+ window.location.href = data.redirect_url;
87
+ })
 
88
  .catch(error => {
89
+ console.error('Error:', error);
 
90
  });
91
+ });
92
 
93
+ function storeAccessToken(token) {
94
+ // Implement your token storage logic here
95
+ console.log("Token stored:", token);
96
+ }
 
 
97
  </script>
98
  </body>
99