What is the purpose of domain-task? #511

Closed
opened 2025-08-09 17:16:34 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @cdxf on 8/13/2017

In React-Redux-Spa template:

import { fetch, addTask } from 'domain-task';
...
            let fetchTask = fetch(`/api/SampleData/WeatherForecasts?startDateIndex=${ startDateIndex }`)
                .then(response => response.json() as Promise<WeatherForecast[]>)
                .then(data => {
                    dispatch({ type: 'RECEIVE_WEATHER_FORECASTS', startDateIndex: startDateIndex, forecasts: data });
                });

            addTask(fetchTask); // Ensure server-side prerendering waits for this to complete

Can you explain what is the purpose of fetch and addTask function, can I just use axios for fetch?

*Originally created by @cdxf on 8/13/2017* In React-Redux-Spa template: ``` import { fetch, addTask } from 'domain-task'; ... let fetchTask = fetch(`/api/SampleData/WeatherForecasts?startDateIndex=${ startDateIndex }`) .then(response => response.json() as Promise<WeatherForecast[]>) .then(data => { dispatch({ type: 'RECEIVE_WEATHER_FORECASTS', startDateIndex: startDateIndex, forecasts: data }); }); addTask(fetchTask); // Ensure server-side prerendering waits for this to complete ``` Can you explain what is the purpose of `fetch` and `addTask` function, can I just use axios for fetch?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#511
No description provided.