feat: persist customer product and shop favorites through the live API

Replace mall fixture favorites with customer-scoped endpoints, and send signed-out shoppers back to the page they left after sign-in.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Chengdong Zhang
2026-09-21 18:51:45 +08:00
co-authored by Cursor
parent 94a64ec712
commit 6c1357ec4d
34 changed files with 1783 additions and 119 deletions
+10 -1
View File
@@ -23,7 +23,8 @@ type LiveDomain =
| "coupons"
| "points"
| "flashSales"
| "groupBuying";
| "groupBuying"
| "favorites";
/**
* Explicit per-domain method picks rather than a string allowlist: indexing
@@ -84,6 +85,13 @@ const LIVE_PICKS = {
groupBuying: (a: ApiClient) => ({
listGroupBuyingActivities: a.listGroupBuyingActivities,
}),
favorites: (a: ApiClient) => ({
listFavorites: a.listFavorites,
addProductFavorite: a.addProductFavorite,
removeProductFavorite: a.removeProductFavorite,
addShopFavorite: a.addShopFavorite,
removeShopFavorite: a.removeShopFavorite,
}),
} satisfies Record<LiveDomain, (a: ApiClient) => Partial<ApiClient>>;
const KNOWN_DOMAINS = Object.keys(LIVE_PICKS) as LiveDomain[];
@@ -106,6 +114,7 @@ const DEFAULT_LIVE_DOMAINS: LiveDomain[] = [
"points",
"flashSales",
"groupBuying",
"favorites",
];
export default defineNuxtPlugin(() => {