<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	תגובות לפוסט: Axios interceptors	</title>
	<atom:link href="https://internet-israel.com/%D7%A4%D7%99%D7%AA%D7%95%D7%97-%D7%90%D7%99%D7%A0%D7%98%D7%A8%D7%A0%D7%98/%D7%A4%D7%99%D7%AA%D7%95%D7%97-%D7%91-javascript/axios-interceptors/feed/" rel="self" type="application/rss+xml" />
	<link>https://internet-israel.com/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%90%d7%99%d7%a0%d7%98%d7%a8%d7%a0%d7%98/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%91-javascript/axios-interceptors/</link>
	<description>רן בר-זיק על פיתוח אינטרנט מתקדם</description>
	<lastBuildDate>Sat, 09 Dec 2023 10:29:07 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>
		מאת: רן בר-זיק		</title>
		<link>https://internet-israel.com/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%90%d7%99%d7%a0%d7%98%d7%a8%d7%a0%d7%98/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%91-javascript/axios-interceptors/comment-page-1/#comment-4691</link>

		<dc:creator><![CDATA[רן בר-זיק]]></dc:creator>
		<pubDate>Sat, 09 Dec 2023 10:29:07 +0000</pubDate>
		<guid isPermaLink="false">https://internet-israel.com/?p=10723#comment-4691</guid>

					<description><![CDATA[לא, מדובר בפיצ׳ר של axios עצמו. הוא יעבוד היטב בכל סביבה. הנה דוגמה של קוד בונילה שעובד מעולה, הדבק אותו כ-index.html והרץ אותו עם
&lt;pre&gt;
 npx serve . 
&lt;/pre&gt;
(הנקודה אחרי ה-serve) ותראה שהוא עובד יופי :)

&lt;pre&gt;
&#060;!DOCTYPE html&#062;
&#060;html lang=&#034;en&#034;&#062;
&#060;head&#062;
    &#060;meta charset=&#034;UTF-8&#034;&#062;
    &#060;meta http-equiv=&#034;X-UA-Compatible&#034; content=&#034;IE=edge&#034;&#062;
    &#060;meta name=&#034;viewport&#034; content=&#034;width=device-width, initial-scale=1.0&#034;&#062;
    &#060;title&#062;Axios Interceptor Demo&#060;/title&#062;
    &#060;script src=&#034;https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js&#034;&#062;&#060;/script&#062;
&#060;/head&#062;
&#060;body&#062;
    &#060;h1&#062;Axios Interceptor Demo&#060;/h1&#062;
    &#060;script&#062;
        // Set up an Axios interceptor
        axios.interceptors.request.use(request =&#062; {
            console.log(&#039;Starting Request&#039;, request);
            // You can modify the request here
            return request;
        }, error =&#062; {
            // Handle errors
            console.error(&#039;Request error:&#039;, error);
            return Promise.reject(error);
        });

        axios.interceptors.response.use(response =&#062; {
            console.log(&#039;Response:&#039;, response);
            // You can modify the response here
            return response;
        }, error =&#062; {
            // Handle errors
            console.error(&#039;Response error:&#039;, error);
            return Promise.reject(error);
        });

        // Example API call
        axios.get(&#039;https://jsonplaceholder.typicode.com/todos/1&#039;)
            .then(response =&#062; {
                console.log(&#039;Data:&#039;, response.data);
            })
            .catch(error =&#062; {
                console.error(&#039;Error during API call:&#039;, error);
            });
    &#060;/script&#062;
&#060;/body&#062;
&#060;/html&#062;

&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>לא, מדובר בפיצ׳ר של axios עצמו. הוא יעבוד היטב בכל סביבה. הנה דוגמה של קוד בונילה שעובד מעולה, הדבק אותו כ-index.html והרץ אותו עם</p>
<pre>
 npx serve . 
</pre>
<p>(הנקודה אחרי ה-serve) ותראה שהוא עובד יופי 🙂</p>
<pre>
&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
    &lt;meta charset=&quot;UTF-8&quot;&gt;
    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
    &lt;title&gt;Axios Interceptor Demo&lt;/title&gt;
    &lt;script src=&quot;https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;h1&gt;Axios Interceptor Demo&lt;/h1&gt;
    &lt;script&gt;
        // Set up an Axios interceptor
        axios.interceptors.request.use(request =&gt; {
            console.log('Starting Request', request);
            // You can modify the request here
            return request;
        }, error =&gt; {
            // Handle errors
            console.error('Request error:', error);
            return Promise.reject(error);
        });

        axios.interceptors.response.use(response =&gt; {
            console.log('Response:', response);
            // You can modify the response here
            return response;
        }, error =&gt; {
            // Handle errors
            console.error('Response error:', error);
            return Promise.reject(error);
        });

        // Example API call
        axios.get('https://jsonplaceholder.typicode.com/todos/1')
            .then(response =&gt; {
                console.log('Data:', response.data);
            })
            .catch(error =&gt; {
                console.error('Error during API call:', error);
            });
    &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;

</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		מאת: מולי		</title>
		<link>https://internet-israel.com/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%90%d7%99%d7%a0%d7%98%d7%a8%d7%a0%d7%98/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%91-javascript/axios-interceptors/comment-page-1/#comment-4690</link>

		<dc:creator><![CDATA[מולי]]></dc:creator>
		<pubDate>Sat, 09 Dec 2023 03:26:32 +0000</pubDate>
		<guid isPermaLink="false">https://internet-israel.com/?p=10723#comment-4690</guid>

					<description><![CDATA[בתגובה על &lt;a href=&quot;https://internet-israel.com/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%90%d7%99%d7%a0%d7%98%d7%a8%d7%a0%d7%98/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%91-javascript/axios-interceptors/comment-page-1/#comment-4680&quot;&gt;רן בר-זיק&lt;/a&gt;.

הבעיה היא התלות ב vite
כפי שהבנתי, הפתרון לא יתאים למי שאינו משתמש ב vite.]]></description>
			<content:encoded><![CDATA[<p>בתגובה על <a href="https://internet-israel.com/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%90%d7%99%d7%a0%d7%98%d7%a8%d7%a0%d7%98/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%91-javascript/axios-interceptors/comment-page-1/#comment-4680">רן בר-זיק</a>.</p>
<p>הבעיה היא התלות ב vite<br />
כפי שהבנתי, הפתרון לא יתאים למי שאינו משתמש ב vite.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		מאת: רן בר-זיק		</title>
		<link>https://internet-israel.com/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%90%d7%99%d7%a0%d7%98%d7%a8%d7%a0%d7%98/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%91-javascript/axios-interceptors/comment-page-1/#comment-4680</link>

		<dc:creator><![CDATA[רן בר-זיק]]></dc:creator>
		<pubDate>Sat, 02 Dec 2023 09:55:22 +0000</pubDate>
		<guid isPermaLink="false">https://internet-israel.com/?p=10723#comment-4680</guid>

					<description><![CDATA[בתגובה על &lt;a href=&quot;https://internet-israel.com/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%90%d7%99%d7%a0%d7%98%d7%a8%d7%a0%d7%98/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%91-javascript/axios-interceptors/comment-page-1/#comment-4671&quot;&gt;מולי&lt;/a&gt;.

לא הבנתי מה הבעיה. ה-axios interceptor הוא סוג של middleware שאמור לעבוד גם עם כמה קריאות במקביל.]]></description>
			<content:encoded><![CDATA[<p>בתגובה על <a href="https://internet-israel.com/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%90%d7%99%d7%a0%d7%98%d7%a8%d7%a0%d7%98/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%91-javascript/axios-interceptors/comment-page-1/#comment-4671">מולי</a>.</p>
<p>לא הבנתי מה הבעיה. ה-axios interceptor הוא סוג של middleware שאמור לעבוד גם עם כמה קריאות במקביל.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		מאת: מולי		</title>
		<link>https://internet-israel.com/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%90%d7%99%d7%a0%d7%98%d7%a8%d7%a0%d7%98/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%91-javascript/axios-interceptors/comment-page-1/#comment-4671</link>

		<dc:creator><![CDATA[מולי]]></dc:creator>
		<pubDate>Mon, 27 Nov 2023 09:50:34 +0000</pubDate>
		<guid isPermaLink="false">https://internet-israel.com/?p=10723#comment-4671</guid>

					<description><![CDATA[לטעמי, עדיין חסר... לדוגמא: אם נוסיף טיפול במספר קריאות, כמו במקרה אופייני של שליפת 100+ פוסטים מוורדפרס, ואז נדרש ביצוע של כמה קריאות במקביל... ואם vite הוא לא אופציה, לא ברור איך להתקדם.

בקיצור, מפתיע שאין פתרון (service) אמין וקיים. בינתיים המצאתי את הגלגל בעצמי - והוא עובד אבל לא גנרי כמו שהייתי רוצה.
אם יש המלצה למשהו בכיוון שתיארתי יהיה נפלא]]></description>
			<content:encoded><![CDATA[<p>לטעמי, עדיין חסר&#8230; לדוגמא: אם נוסיף טיפול במספר קריאות, כמו במקרה אופייני של שליפת 100+ פוסטים מוורדפרס, ואז נדרש ביצוע של כמה קריאות במקביל&#8230; ואם vite הוא לא אופציה, לא ברור איך להתקדם.</p>
<p>בקיצור, מפתיע שאין פתרון (service) אמין וקיים. בינתיים המצאתי את הגלגל בעצמי &#8211; והוא עובד אבל לא גנרי כמו שהייתי רוצה.<br />
אם יש המלצה למשהו בכיוון שתיארתי יהיה נפלא</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		מאת: שלמה		</title>
		<link>https://internet-israel.com/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%90%d7%99%d7%a0%d7%98%d7%a8%d7%a0%d7%98/%d7%a4%d7%99%d7%aa%d7%95%d7%97-%d7%91-javascript/axios-interceptors/comment-page-1/#comment-4601</link>

		<dc:creator><![CDATA[שלמה]]></dc:creator>
		<pubDate>Sun, 01 Oct 2023 09:07:50 +0000</pubDate>
		<guid isPermaLink="false">https://internet-israel.com/?p=10723#comment-4601</guid>

					<description><![CDATA[נושא חשוב, זה באמת כלי שמאפשר דברים יפים ואלגנטיים מאוד. לדוגמה להגדיר באופן גלובלי שאם השרת מחזיר קוד שגיאה 401 בתגובה לקריאת HTTP כלשהי, לנתק את הסשן בקליינט, להקפיץ הודעת שגיאה ולהעביר לדף לוגין.]]></description>
			<content:encoded><![CDATA[<p>נושא חשוב, זה באמת כלי שמאפשר דברים יפים ואלגנטיים מאוד. לדוגמה להגדיר באופן גלובלי שאם השרת מחזיר קוד שגיאה 401 בתגובה לקריאת HTTP כלשהי, לנתק את הסשן בקליינט, להקפיץ הודעת שגיאה ולהעביר לדף לוגין.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
