From 66e4747d3fb01bf354123763bed9dd80fb390bf8 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Wed, 17 Feb 2021 10:37:05 -0500 Subject: [PATCH] Change fetch to our request utility function. (#12709) --- app/javascript/readingList/readingList.jsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/javascript/readingList/readingList.jsx b/app/javascript/readingList/readingList.jsx index 447533739..50909e0af 100644 --- a/app/javascript/readingList/readingList.jsx +++ b/app/javascript/readingList/readingList.jsx @@ -16,6 +16,7 @@ import { ItemListItemArchiveButton } from './components/ItemListItemArchiveButto import { ItemListLoadMoreButton } from './components/ItemListLoadMoreButton'; import { ItemListTags } from './components/ItemListTags'; import { Button } from '@crayons'; +import { request } from '@utilities/http'; const STATUS_VIEW_VALID = 'valid,confirmed'; const STATUS_VIEW_ARCHIVED = 'archived'; @@ -88,14 +89,9 @@ export class ReadingList extends Component { event.preventDefault(); const { statusView, items, totalCount } = this.state; - window.fetch(`/reading_list_items/${item.id}`, { + request(`/reading_list_items/${item.id}`, { method: 'PUT', - headers: { - 'X-CSRF-Token': window.csrfToken, - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ current_status: statusView }), - credentials: 'same-origin', + body: { current_status: statusView }, }); const t = this;