-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(GIST-53): delete gist on ui (#15)
- Loading branch information
1 parent
ff200cc
commit d73d5b7
Showing
2 changed files
with
55 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,45 @@ | ||
'use client' | ||
import { Gist } from '@/types' | ||
import MyGistList from '../ui/mygist-list' | ||
import { useGists } from '@/lib/queries/gists.queries' | ||
"use client"; | ||
import { Gist } from "@/types"; | ||
import MyGistList from "../ui/mygist-list"; | ||
import { useDeleteGist, useGists } from "@/lib/queries/gists.queries"; | ||
|
||
// TODO: Get the gists list | ||
|
||
const gistMock: Gist[] = [ | ||
{ | ||
id: '1', | ||
name: 'My first Gist', | ||
id: "1", | ||
name: "My first Gist", | ||
code: 'console.log("Hello, World!")', | ||
}, | ||
{ | ||
id: '2', | ||
name: 'My second Gist', | ||
id: "2", | ||
name: "My second Gist", | ||
code: 'console.log("Hello, World!")', | ||
}, | ||
{ | ||
id: '3', | ||
name: 'My third Gist', | ||
id: "3", | ||
name: "My third Gist", | ||
code: 'console.log("Hello, World!")', | ||
}, | ||
{ | ||
id: '4', | ||
name: 'My fourth Gist', | ||
id: "4", | ||
name: "My fourth Gist", | ||
code: 'console.log("Hello, World!")', | ||
}, | ||
] | ||
]; | ||
|
||
const handleDeleteGist = (id: string) => { | ||
console.log(`Deleting gist with ID: ${id}`) | ||
} | ||
const handleDeleteGist = (id: string) => {}; | ||
|
||
export function MyGistListFeature() { | ||
const { data } = useGists() | ||
const { data } = useGists(); | ||
const { mutate: deleteGist } = useDeleteGist({ | ||
onSuccess: (id) => { | ||
console.log(`Deleting gist with ID: ${id}`); | ||
}, | ||
}); | ||
const handleDeleteGist = (id: string) => { | ||
deleteGist(id); | ||
}; | ||
|
||
return <MyGistList gists={data || []} onDeleteGist={handleDeleteGist} /> | ||
return <MyGistList gists={data || []} onDeleteGist={handleDeleteGist} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters