{
- if (isEdit) {
+ if (isEdit && preSelectedTime) {
const date = moment(preSelectedTime);
+
setSelectedDate(date.toDate());
setSelectedTime(date.toDate());
setDateTimeDisplay(date.format('D MMMM YYYY @ h A'));
}
- }, [isEdit]);
+ }, [isEdit, preSelectedTime]);
return (
diff --git a/src/components/pages/pageIndex/HeatmapChart.tsx b/src/components/pages/pageIndex/HeatmapChart.tsx
index 526075d2..d578ea17 100644
--- a/src/components/pages/pageIndex/HeatmapChart.tsx
+++ b/src/components/pages/pageIndex/HeatmapChart.tsx
@@ -58,8 +58,6 @@ const HeatmapChart = () => {
const fetchData = async () => {
setLoading(true);
try {
- console.log({ selectedSubChannels });
-
if (platformId) {
const data = await fetchHeatmapData(
platformId,
diff --git a/src/pages/announcements/edit-announcements/index.tsx b/src/pages/announcements/edit-announcements/index.tsx
index e67287d4..ee475759 100644
--- a/src/pages/announcements/edit-announcements/index.tsx
+++ b/src/pages/announcements/edit-announcements/index.tsx
@@ -113,7 +113,6 @@ function Index() {
(channel) => channel.channelId
);
}
- console.log({ channelIds });
await refreshData(platformId, 'channel', channelIds, undefined, false);
}
@@ -127,7 +126,9 @@ function Index() {
if (!id) return;
const fetchAnnouncement = async () => {
const data = await retrieveAnnouncementById(id);
+
setFetchedAnnouncements(data);
+ setScheduledAt(data.scheduledAt);
};
fetchAnnouncement();
@@ -155,9 +156,10 @@ function Index() {
try {
setLoading(true);
const data = await patchExistingAnnouncement(id, announcementsPayload);
+
if (data) {
showMessage('Announcement updated successfully', 'success');
- router.push('/announcements');
+ location.replace('/announcements');
}
} catch (error) {
showMessage('Failed to create announcement', 'error');
diff --git a/src/store/slices/announcementsSlice.ts b/src/store/slices/announcementsSlice.ts
index 1d2a06fb..984afcd4 100644
--- a/src/store/slices/announcementsSlice.ts
+++ b/src/store/slices/announcementsSlice.ts
@@ -10,7 +10,6 @@ const createAnnouncementsSlice: StateCreator = (set, get) => ({
page,
limit,
sortBy,
- ngu,
timeZone,
startDate,
endDate,
@@ -24,7 +23,6 @@ const createAnnouncementsSlice: StateCreator = (set, get) => ({
...(timeZone ? { timeZone } : {}),
...(startDate ? { startDate } : {}),
...(endDate ? { endDate } : {}),
- ...(ngu ? { name } : {}),
};
const { data } = await axiosInstance.get(
@@ -63,8 +61,6 @@ const createAnnouncementsSlice: StateCreator = (set, get) => ({
announcementPayload: CreateAnnouncementsPayload
) => {
try {
- console.log({ id });
-
const { data } = await axiosInstance.patch(
`/announcements/${id}`,
announcementPayload
diff --git a/src/store/slices/platformSlice.ts b/src/store/slices/platformSlice.ts
index 243096e1..8bee293b 100644
--- a/src/store/slices/platformSlice.ts
+++ b/src/store/slices/platformSlice.ts
@@ -72,6 +72,7 @@ const createPlatfromSlice: StateCreator = (set, get) => ({
platformId,
property = 'channel',
name,
+ ngu,
sortBy,
page,
limit,
@@ -89,6 +90,8 @@ const createPlatfromSlice: StateCreator = (set, get) => ({
if (name) params.append('name', name);
+ if (ngu) params.append('ngu', ngu);
+
if (page !== undefined) {
params.append('page', page.toString());
}
diff --git a/src/store/types/IAnnouncements.ts b/src/store/types/IAnnouncements.ts
index 37937eac..672897f2 100644
--- a/src/store/types/IAnnouncements.ts
+++ b/src/store/types/IAnnouncements.ts
@@ -2,7 +2,6 @@ export interface IRetrieveAnnouncementsProps {
page: number;
limit: number;
sortBy?: string;
- ngu?: string;
community: string;
startDate?: string;
endDate?: string;
@@ -14,7 +13,6 @@ export default interface IAnnouncements {
page,
limit,
sortBy,
- ngu,
community,
}: IRetrieveAnnouncementsProps) => void;
}
diff --git a/src/store/types/IPlatform.ts b/src/store/types/IPlatform.ts
index f88e42ca..16c7574d 100644
--- a/src/store/types/IPlatform.ts
+++ b/src/store/types/IPlatform.ts
@@ -13,6 +13,7 @@ export interface IRetrivePlatformRolesOrChannels {
limit?: number;
sortBy?: string;
name?: string;
+ ngu?: string;
platformId: string;
property: 'channel' | 'role' | 'guildMember';
}