take shorturl data
This commit is contained in:
29
app/utils/store.ts
Normal file
29
app/utils/store.ts
Normal 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 }),
|
||||
}));
|
||||
Reference in New Issue
Block a user