feat(characters): use local character catalog
This commit is contained in:
@@ -4,7 +4,11 @@ import { AuthStorage } from "@/data/storage/auth/auth_storage";
|
||||
import { UserStorage } from "@/data/storage/user/user_storage";
|
||||
import type { PendingChatPromotionType } from "@/data/storage/navigation";
|
||||
import type { LoginStatus } from "@/data/schemas/auth";
|
||||
import { ROUTES } from "@/router/routes";
|
||||
import {
|
||||
DEFAULT_CHARACTER_SLUG,
|
||||
getCharacterBySlug,
|
||||
} from "@/data/constants/character";
|
||||
import { getCharacterRoutes, ROUTES } from "@/router/routes";
|
||||
|
||||
export type ExternalEntryTarget =
|
||||
| typeof ROUTES.chat
|
||||
@@ -20,6 +24,7 @@ export interface ExternalEntryPayload {
|
||||
|
||||
export interface ExternalEntryTargetInput {
|
||||
target?: string | null;
|
||||
character?: string | null;
|
||||
}
|
||||
|
||||
export interface ExternalEntryPromotionInput {
|
||||
@@ -79,8 +84,15 @@ export function resolveExternalEntryTarget({
|
||||
|
||||
export function resolveExternalEntryDestination({
|
||||
target,
|
||||
character,
|
||||
}: ExternalEntryTargetInput): string {
|
||||
return resolveExternalEntryTarget({ target });
|
||||
const characterSlug =
|
||||
getCharacterBySlug(character)?.slug ?? DEFAULT_CHARACTER_SLUG;
|
||||
const routes = getCharacterRoutes(characterSlug);
|
||||
const resolvedTarget = resolveExternalEntryTarget({ target });
|
||||
if (resolvedTarget === ROUTES.tip) return routes.tip;
|
||||
if (resolvedTarget === ROUTES.privateRoom) return routes.privateRoom;
|
||||
return routes.chat;
|
||||
}
|
||||
|
||||
export async function persistExternalEntryPayload({
|
||||
|
||||
Reference in New Issue
Block a user