feat: implement sharing
This commit is contained in:
parent
385b31d42c
commit
8cc3fea048
19 changed files with 507 additions and 96 deletions
12
lib/types.ts
12
lib/types.ts
|
|
@ -5,5 +5,17 @@ export interface Chat extends Record<string, any> {
|
|||
title: string
|
||||
createdAt: Date
|
||||
userId: string
|
||||
path: string
|
||||
messages: Message[]
|
||||
}
|
||||
|
||||
export interface Share {
|
||||
id: string
|
||||
title: string
|
||||
createdAt: number
|
||||
userId: string
|
||||
path: string
|
||||
chat: Chat
|
||||
}
|
||||
|
||||
export type ServerActionResult<Result> = Promise<Result | Error>
|
||||
|
|
|
|||
|
|
@ -32,3 +32,12 @@ export async function fetcher<JSON = any>(
|
|||
|
||||
return res.json()
|
||||
}
|
||||
|
||||
export function formatDate(input: string | number | Date): string {
|
||||
const date = new Date(input)
|
||||
return date.toLocaleDateString('en-US', {
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
year: 'numeric'
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue