-
-
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.
refactor: ✨ Add threaded view to Notes
- Loading branch information
1 parent
4c3b637
commit e578fa3
Showing
4 changed files
with
70 additions
and
32 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
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
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,18 +1,24 @@ | ||
import type { Client } from "@versia/client"; | ||
import type { Status } from "@versia/client/types"; | ||
|
||
export const useNote = (client: MaybeRef<Client | null>, noteId: string) => { | ||
if (!ref(client).value) { | ||
export const useNote = ( | ||
client: MaybeRef<Client | null>, | ||
noteId: MaybeRef<string | null>, | ||
) => { | ||
if (!(toValue(client) && toValue(noteId))) { | ||
return ref(null as Status | null); | ||
} | ||
|
||
const output = ref(null as Status | null); | ||
|
||
ref(client) | ||
.value?.getStatus(noteId) | ||
.then((res) => { | ||
output.value = res.data; | ||
}); | ||
watchEffect(() => { | ||
toValue(noteId) && | ||
toValue(client) | ||
?.getStatus(toValue(noteId) as string) | ||
.then((res) => { | ||
output.value = res.data; | ||
}); | ||
}); | ||
|
||
return output; | ||
}; |
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