take shorturl data

This commit is contained in:
2025-04-07 23:20:48 +08:00
parent ed327ad3f0
commit d0e83f697b
6 changed files with 153 additions and 3 deletions

29
app/utils/store.ts Normal file
View File

@@ -0,0 +1,29 @@
import { create } from 'zustand';
// 定义 ShortUrl 数据类型
export interface ShortUrlData {
id: string;
slug: string;
originalUrl: string;
title?: string;
shortUrl: string;
teams?: any[];
projects?: any[];
tags?: any[];
createdAt?: string;
domain?: string;
}
// 定义 store 类型
interface ShortUrlStore {
selectedShortUrl: ShortUrlData | null;
setSelectedShortUrl: (shortUrl: ShortUrlData | null) => void;
clearSelectedShortUrl: () => void;
}
// 创建 store
export const useShortUrlStore = create<ShortUrlStore>((set) => ({
selectedShortUrl: null,
setSelectedShortUrl: (shortUrl) => set({ selectedShortUrl: shortUrl }),
clearSelectedShortUrl: () => set({ selectedShortUrl: null }),
}));