How to update cart total summary section using js Magento 2?

You can reload or update cart total summary sidebar section in Magento by using Magento_Checkout/js/action/get-totals file.

A get-totals.js file used to reload a cart summary block on the cart page.

This article will be useful when you are updating cart items using Ajax and in the success response of the cart update, you just need to reload total summary in the right sidebar to match the total with updated cart items.

When you explore the get-totals javascript, that returns the function with two arguments, the first one is callbacks, and the second is a deferred object.

A Given code snippet to update/reload total summary section,

], function ($, getTotalsAction) {
    'use strict';
    // The cart page totals summary block update
    var deferred = $.Deferred();
    getTotalsAction([], deferred);

Just call the getTotalsAction object method and your cart total summary block will be reloaded with the latest total of the cart items.

For the Login Customer, request URL will be <HOST>/rest/V1/carts/mine/total 

For Guest User, A Request URL will be,<HOST>/rest/V1/guest-carts/:quoteId/totals