Обновить templates/modal.html
This commit is contained in:
		
							parent
							
								
									a0335727b7
								
							
						
					
					
						commit
						cf669b25a1
					
				| 
						 | 
				
			
			@ -114,7 +114,7 @@
 | 
			
		|||
                                            <div class="border border-gray-200 rounded-md p-5 mt-5">
 | 
			
		||||
                                                
 | 
			
		||||
                                        
 | 
			
		||||
                                        
 | 
			
		||||
                                                <div id="knows-container"></div>
 | 
			
		||||
                                            </div>
 | 
			
		||||
                                        </div>
 | 
			
		||||
                                                    
 | 
			
		||||
| 
						 | 
				
			
			@ -217,7 +217,7 @@ document.addEventListener("DOMContentLoaded", () => {
 | 
			
		|||
                    
 | 
			
		||||
                    document.getElementById("contactinfo").innerHTML = data.email_addr + '<br>' + data.phone_num;+
 | 
			
		||||
 | 
			
		||||
                    
 | 
			
		||||
                   
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                    
 | 
			
		||||
| 
						 | 
				
			
			@ -225,33 +225,23 @@ document.addEventListener("DOMContentLoaded", () => {
 | 
			
		|||
 | 
			
		||||
                    modal.classList.remove("hidden");
 | 
			
		||||
 | 
			
		||||
                    // Потом работаем с getKnows
 | 
			
		||||
                    const token = data.token;
 | 
			
		||||
                    console.log("Токен:", token);
 | 
			
		||||
                    if (token) {
 | 
			
		||||
                        fetch("https://devnet.turboapply.ai/api/getKnows", {
 | 
			
		||||
                            method: "GET",
 | 
			
		||||
                            headers: {
 | 
			
		||||
                                "token": token
 | 
			
		||||
                            }
 | 
			
		||||
                        })
 | 
			
		||||
                        .then(response => {
 | 
			
		||||
                            if (!response.ok) throw new Error("Network error");
 | 
			
		||||
                            return response.json();
 | 
			
		||||
                        })
 | 
			
		||||
                        .then(result => {
 | 
			
		||||
                            console.log("Результат запроса getKnows:", result);
 | 
			
		||||
                            // Тут можно вставить в DOM
 | 
			
		||||
                        })
 | 
			
		||||
                        .catch(error => {
 | 
			
		||||
                            console.error("Ошибка запроса getKnows:", error);
 | 
			
		||||
                        });
 | 
			
		||||
                    } else {
 | 
			
		||||
                        console.warn("Токен отсутствует, getKnows не запрашивается");
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    // Отображаем знания (knows)
 | 
			
		||||
                    const knows = data.knows?.result || [];
 | 
			
		||||
                    const knowsContainer = document.getElementById("knows-container");
 | 
			
		||||
                    knowsContainer.innerHTML = ""; // Очистка контейнера перед добавлением новых данных
 | 
			
		||||
 | 
			
		||||
                    knows.forEach(item => {
 | 
			
		||||
                        const block = document.createElement("div");
 | 
			
		||||
                        block.className = "intro-y box p-4";
 | 
			
		||||
                        block.innerHTML = `
 | 
			
		||||
                            <div class="font-medium text-lg">${item.title}</div>
 | 
			
		||||
                            <span>${item.text}</span>
 | 
			
		||||
                        `;
 | 
			
		||||
                        knowsContainer.appendChild(block);
 | 
			
		||||
                    });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                    
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                })
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue