fix bug back navigation
This commit is contained in:
@@ -125,6 +125,7 @@ export default class UserProductHandler {
|
||||
const [country, city, district] = callbackQuery.data.replace('shop_district_', '').split('_');
|
||||
|
||||
try {
|
||||
// Получаем информацию о локации
|
||||
const location = await LocationService.getLocation(country, city, district);
|
||||
|
||||
if (!location) {
|
||||
@@ -136,7 +137,7 @@ export default class UserProductHandler {
|
||||
message_id: messageId,
|
||||
reply_markup: {
|
||||
inline_keyboard: [[
|
||||
{ text: '« Back', callback_data: 'shop_start' }
|
||||
{ text: '« Back', callback_data: `shop_city_${country}_${city}` }
|
||||
]]
|
||||
}
|
||||
}
|
||||
@@ -144,6 +145,12 @@ export default class UserProductHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
// Сохраняем текстовое представление локации в состоянии пользователя
|
||||
userStates.set(chatId, {
|
||||
location: `${country}_${city}_${district}`
|
||||
});
|
||||
|
||||
// Получаем категории для выбранной локации
|
||||
const categories = await CategoryService.getCategoriesByLocationId(location.id);
|
||||
|
||||
const keyboard = {
|
||||
@@ -201,7 +208,7 @@ export default class UserProductHandler {
|
||||
{
|
||||
reply_markup: {
|
||||
inline_keyboard: [[
|
||||
{ text: '« Back', callback_data: `shop_district_${locationId}` }
|
||||
{ text: '« Back', callback_data: `shop_district_${state.location}` }
|
||||
]]
|
||||
}
|
||||
}
|
||||
@@ -221,7 +228,7 @@ export default class UserProductHandler {
|
||||
|
||||
// Добавляем кнопку "Назад"
|
||||
keyboard.inline_keyboard.push([
|
||||
{ text: '« Back', callback_data: `shop_district_${locationId}` }
|
||||
{ text: '« Back', callback_data: `shop_district_${state.location}` }
|
||||
]);
|
||||
|
||||
// Отправляем сообщение с товарами
|
||||
|
||||
Reference in New Issue
Block a user