forked from github/plane
fix: notification subscribe endpoint (#1593)
* refactor: height of popover & api fetch call * fix: notification subscribe endpoint
This commit is contained in:
parent
4aef8c2242
commit
51f10d5f36
@ -31,11 +31,18 @@ const useUserIssueNotificationSubscription = (
|
|||||||
const handleUnsubscribe = useCallback(() => {
|
const handleUnsubscribe = useCallback(() => {
|
||||||
if (!workspaceSlug || !projectId || !issueId) return;
|
if (!workspaceSlug || !projectId || !issueId) return;
|
||||||
|
|
||||||
|
mutate(
|
||||||
|
{
|
||||||
|
subscribed: false,
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
userNotificationServices
|
userNotificationServices
|
||||||
.unsubscribeFromIssueNotifications(
|
.unsubscribeFromIssueNotifications(
|
||||||
workspaceSlug as string,
|
workspaceSlug.toString(),
|
||||||
projectId as string,
|
projectId.toString(),
|
||||||
issueId as string
|
issueId.toString()
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
mutate({
|
mutate({
|
||||||
@ -47,14 +54,18 @@ const useUserIssueNotificationSubscription = (
|
|||||||
const handleSubscribe = useCallback(() => {
|
const handleSubscribe = useCallback(() => {
|
||||||
if (!workspaceSlug || !projectId || !issueId || !user) return;
|
if (!workspaceSlug || !projectId || !issueId || !user) return;
|
||||||
|
|
||||||
|
mutate(
|
||||||
|
{
|
||||||
|
subscribed: true,
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
userNotificationServices
|
userNotificationServices
|
||||||
.subscribeToIssueNotifications(
|
.subscribeToIssueNotifications(
|
||||||
workspaceSlug as string,
|
workspaceSlug.toString(),
|
||||||
projectId as string,
|
projectId.toString(),
|
||||||
issueId as string,
|
issueId.toString()
|
||||||
{
|
|
||||||
subscriber: user.id,
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
mutate({
|
mutate({
|
||||||
|
@ -111,14 +111,10 @@ class UserNotificationsServices extends APIService {
|
|||||||
async subscribeToIssueNotifications(
|
async subscribeToIssueNotifications(
|
||||||
workspaceSlug: string,
|
workspaceSlug: string,
|
||||||
projectId: string,
|
projectId: string,
|
||||||
issueId: string,
|
issueId: string
|
||||||
data: {
|
|
||||||
subscriber: string;
|
|
||||||
}
|
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
return this.post(
|
return this.post(
|
||||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/issue-subscribers/`,
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/subscribe/`
|
||||||
data
|
|
||||||
)
|
)
|
||||||
.then((response) => response?.data)
|
.then((response) => response?.data)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user