Parcourir la source

add of base to post request

Jérôme BUISINE il y a 4 ans
Parent
commit
8cd6a57ab2
2 fichiers modifiés avec 10 ajouts et 5 suppressions
  1. 8 3
      links/views.py
  2. 2 2
      static/js/links.js

+ 8 - 3
links/views.py

@@ -51,7 +51,7 @@ def load_index(request):
     - experiment identifiers available from configuration
     '''
 
-    data = {}
+    data = get_base_data()
 
     # get all configurations
     configurations = configurations_collection.find()
@@ -69,7 +69,9 @@ def load_index(request):
 
 def check_user_id(request):
 
-    data = {'status': True, 'message': None}
+    data = get_base_data()
+    data['status'] = True
+    data['message'] = None
 
     if request.method == 'POST':
         
@@ -111,7 +113,10 @@ def generate_user_link(request):
     Generate link is possible for user, otherwise send an issue with error code
     '''
 
-    data = {'status': False}
+    data = get_base_data()
+    data['status'] = True
+    data['message'] = None
+    
     # create link and add it to local storage of navigator
     if request.method == 'POST':
 

+ 2 - 2
static/js/links.js

@@ -43,7 +43,7 @@ async function searchUserId(){
 
     let data = {'guildId': guildId, 'userId': userId}
     
-    fetch('/check', {
+    fetch(`${BASE}/check`, {
         method: 'POST',
         body: JSON.stringify(data),
         headers: {
@@ -89,7 +89,7 @@ async function generateLink(){
 
     let data = {'guildId': guildId, 'userId': userId}
     
-    fetch('/generate', {
+    fetch(`${BASE}/generate`, {
         method: 'POST',
         body: JSON.stringify(data),
         headers: {