<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[fetch שא&quot;א לקבל ממנו את הנתונים]]></title><description><![CDATA[<p dir="auto">הבקשה חוזרת עם סטטוס 200, אבל אני לא מצליח לגשת לנתונים.<br />
בקוד דלהלן יש שגיאה שא"א לקבל את הנתונים בJSON. מצ"ב תמונה (השגיאה האדומה שם למעלה בצד ימין).</p>
<pre><code>fetch('http://admin.co.il:200/index.php?p=login&amp;user='+user.username_or_email+'&amp;password='+user.password)
     .then(user =&gt; {
        context.commit('loginUserSuccess', user);
	console.log(user);
     })
     .then(response =&gt; response.json())
     .then(resText =&gt; console.log(resText) )
     .catch(error =&gt; {
	context.commit('loginUserFailure', error);
     });
</code></pre>
<p dir="auto"><img src="/assets/uploads/files/1629471837974-7ffa9e5d-3472-4795-a937-1ac9597f417d-image.png" alt="7ffa9e5d-3472-4795-a937-1ac9597f417d-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://tchumim.com/topic/11803/fetch-שא-א-לקבל-ממנו-את-הנתונים</link><generator>RSS for Node</generator><lastBuildDate>Mon, 08 Jun 2026 17:16:35 GMT</lastBuildDate><atom:link href="https://tchumim.com/topic/11803.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 20 Aug 2021 15:25:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to fetch שא&quot;א לקבל ממנו את הנתונים on Sun, 22 Aug 2021 16:08:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/%D7%97%D7%95%D7%A7%D7%A8">@<bdi>חוקר</bdi></a> then השני מיותר כי אפשר להחזיר אותו כבר מהראשון</p>
<pre><code>     .then(user =&gt; {
        context.commit('loginUserSuccess', user);
       	console.log(user);
        return user.json();
      
      })

</code></pre>
<p dir="auto">לכאורה יותר נכון לחכות שהפרומיס של ה json יסתיים, ואז להקפיץ את ההודעה על ההצלחה, כרגע יש הודעת הצלחה לפני שיש לך תשובה ביד, יש רק הידרים</p>
<pre><code>     .then(user =&gt; {
        const user = await user.json();
        context.commit('loginUserSuccess', user);
       	console.log(user);
        return user
      
      })

</code></pre>
]]></description><link>https://tchumim.com/post/127736</link><guid isPermaLink="true">https://tchumim.com/post/127736</guid><dc:creator><![CDATA[יוסף בן שמעון]]></dc:creator><pubDate>Sun, 22 Aug 2021 16:08:45 GMT</pubDate></item><item><title><![CDATA[Reply to fetch שא&quot;א לקבל ממנו את הנתונים on Sun, 22 Aug 2021 06:40:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chagold">@<bdi>chagold</bdi></a> אמר ב<a href="/post/127672">fetch שא"א לקבל ממנו את הנתונים</a>:</p>
<blockquote>
<p dir="auto">הבקשה חוזרת עם סטטוס 200, אבל אני לא מצליח לגשת לנתונים.<br />
בקוד דלהלן יש שגיאה שא"א לקבל את הנתונים בJSON. מצ"ב תמונה (השגיאה האדומה שם למעלה בצד ימין).</p>
<pre><code>fetch('http://admin.co.il:200/index.php?p=login&amp;user='+user.username_or_email+'&amp;password='+user.password)
     .then(user =&gt; {
        context.commit('loginUserSuccess', user);
	console.log(user);
     })
     .then(response =&gt; response.json())
     .then(resText =&gt; console.log(resText) )
     .catch(error =&gt; {
	context.commit('loginUserFailure', error);
     });
</code></pre>
</blockquote>
<p dir="auto">אתה לא מחזיר כלום מהשלב הראשון הלאה<br />
תנסה כך</p>
<pre><code>fetch('http://admin.co.il:200/index.php?p=login&amp;user='+user.username_or_email+'&amp;password='+user.password)
     .then(user =&gt; {
        context.commit('loginUserSuccess', user);
	console.log(user);
        return user;
     })
     .then(response =&gt; response.json())
     .then(resText =&gt; console.log(resText) )
     .catch(error =&gt; {
	context.commit('loginUserFailure', error);
     });
</code></pre>
]]></description><link>https://tchumim.com/post/127703</link><guid isPermaLink="true">https://tchumim.com/post/127703</guid><dc:creator><![CDATA[חוקר]]></dc:creator><pubDate>Sun, 22 Aug 2021 06:40:43 GMT</pubDate></item><item><title><![CDATA[Reply to fetch שא&quot;א לקבל ממנו את הנתונים on Fri, 20 Aug 2021 15:36:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chagold">@<bdi>chagold</bdi></a> ה then הראשון לא מחזיר שום ערך, אז השני לא מקבל אותו, לכן ה response הוא אנדיפיינד</p>
]]></description><link>https://tchumim.com/post/127673</link><guid isPermaLink="true">https://tchumim.com/post/127673</guid><dc:creator><![CDATA[יוסף בן שמעון]]></dc:creator><pubDate>Fri, 20 Aug 2021 15:36:45 GMT</pubDate></item></channel></rss>