From 1d63f3ec1bf8eec31ececdbc0aab91a308c081cd Mon Sep 17 00:00:00 2001
From: Yurii Hryshchenko <79473530+YuriyHryshchenko@users.noreply.github.com>
Date: Tue, 19 Sep 2023 11:23:08 +0300
Subject: [PATCH] Sort regions (#822)

---
 src/models/properties/asyncActions.ts | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/models/properties/asyncActions.ts b/src/models/properties/asyncActions.ts
index b829ea1dc..c57f9cbca 100644
--- a/src/models/properties/asyncActions.ts
+++ b/src/models/properties/asyncActions.ts
@@ -1,20 +1,26 @@
 /* eslint-disable */
 import {
+  getCities,
   getDirections,
   getOrigins,
   getPostTypes,
   getRegions,
   getTagsByValue,
-  getCities,
 } from '../../old/lib/utilities/API/api';
 import { createAsyncThunk } from '@reduxjs/toolkit';
+import { RegionResponseType } from '../../old/lib/utilities/API/types';
 
 export const fetchRegions = createAsyncThunk(
   'properties/fetchRegions',
   async (_, { rejectWithValue }) => {
     try {
       const response = await getRegions();
-      return response.data;
+      const data = response.data.sort(
+        (a: RegionResponseType, b: RegionResponseType) => {
+          return a.name.localeCompare(b.name);
+        },
+      );
+      return data;
     } catch (err) {
       return rejectWithValue(err.response?.data);
     }