mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-29 03:13:45 +01:00
feat: adds save preferences on collections
This commit is contained in:
parent
be4fc2d9ad
commit
fc2931855e
@ -1,5 +1,6 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
import { savePreferences } from 'providers/ReduxStore/slices/app';
|
||||||
import {
|
import {
|
||||||
IconSearch,
|
IconSearch,
|
||||||
IconFolders,
|
IconFolders,
|
||||||
@ -22,6 +23,8 @@ const CollectionsBadge = () => {
|
|||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const { collections } = useSelector((state) => state.collections);
|
const { collections } = useSelector((state) => state.collections);
|
||||||
const { collectionSortOrder } = useSelector((state) => state.collections);
|
const { collectionSortOrder } = useSelector((state) => state.collections);
|
||||||
|
const preferences = useSelector((state) => state.app.preferences);
|
||||||
|
|
||||||
const sortCollectionOrder = () => {
|
const sortCollectionOrder = () => {
|
||||||
let order;
|
let order;
|
||||||
switch (collectionSortOrder) {
|
switch (collectionSortOrder) {
|
||||||
@ -36,6 +39,10 @@ const CollectionsBadge = () => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dispatch(sortCollections({ order }));
|
dispatch(sortCollections({ order }));
|
||||||
|
dispatch(savePreferences({
|
||||||
|
...preferences,
|
||||||
|
collectionSortOrder: order
|
||||||
|
}));
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div className="items-center mt-2 relative">
|
<div className="items-center mt-2 relative">
|
||||||
|
Loading…
Reference in New Issue
Block a user