remove the uri from the failed list if the user reattempts getting the same uri #151
2 changed files with 24 additions and 0 deletions
8
flow-typed/File.js
vendored
8
flow-typed/File.js
vendored
|
@ -55,3 +55,11 @@ declare type PurchaseUriFailed = {
|
|||
uri: string
|
||||
},
|
||||
};
|
||||
|
||||
declare type PurchaseUriStarted = {
|
||||
type: ACTIONS.PURCHASE_URI_STARTED,
|
||||
data: {
|
||||
uri: string,
|
||||
streamingUrl: string,
|
||||
},
|
||||
};
|
|
@ -8,6 +8,22 @@ const defaultState = {
|
|||
purchasedStreamingUrls: {},
|
||||
};
|
||||
|
||||
reducers[ACTIONS.PURCHASE_URI_STARTED] = (
|
||||
state: FileState,
|
||||
action: PurchaseUriStarted
|
||||
): FileState => {
|
||||
const { uri } = action.data;
|
||||
const newFailedPurchaseUris = state.failedPurchaseUris.slice();
|
||||
if (newFailedPurchaseUris.includes(uri)) {
|
||||
newFailedPurchaseUris.splice(newFailedPurchaseUris.indexOf(uri), 1);
|
||||
}
|
||||
|
||||
return {
|
||||
...state,
|
||||
failedPurchaseUris: newFailedPurchaseUris,
|
||||
};
|
||||
};
|
||||
|
||||
reducers[ACTIONS.PURCHASE_URI_COMPLETED] = (
|
||||
state: FileState,
|
||||
action: PurchaseUriCompleted
|
||||
|
|
Loading…
Add table
Reference in a new issue