aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-01-11 21:43:11 +0800
committercrupest <crupest@outlook.com>2021-01-11 21:43:11 +0800
commit555fe9fb1ae5227a535e6beff05e7237cbbccfce (patch)
tree0575da4ebed3a7c8bf3e03656c81e928a9df0831 /FrontEnd
parent873bb613bc2deb86a4266bac160d14be265f9609 (diff)
downloadtimeline-555fe9fb1ae5227a535e6beff05e7237cbbccfce.tar.gz
timeline-555fe9fb1ae5227a535e6beff05e7237cbbccfce.tar.bz2
timeline-555fe9fb1ae5227a535e6beff05e7237cbbccfce.zip
...
Diffstat (limited to 'FrontEnd')
-rw-r--r--FrontEnd/src/app/services/timeline.ts7
-rw-r--r--FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx18
2 files changed, 3 insertions, 22 deletions
diff --git a/FrontEnd/src/app/services/timeline.ts b/FrontEnd/src/app/services/timeline.ts
index ed24c005..46feb4d9 100644
--- a/FrontEnd/src/app/services/timeline.ts
+++ b/FrontEnd/src/app/services/timeline.ts
@@ -451,10 +451,7 @@ export function validateTimelineName(name: string): boolean {
export function useTimeline(
timelineName: string
-): [
- DataAndStatus<TimelineInfo | "notexist">,
- React.Dispatch<React.SetStateAction<DataAndStatus<TimelineInfo | "notexist">>>
-] {
+): DataAndStatus<TimelineInfo | "notexist"> {
const [state, setState] = React.useState<
DataAndStatus<TimelineInfo | "notexist">
>({
@@ -472,7 +469,7 @@ export function useTimeline(
subscription.unsubscribe();
};
}, [timelineName]);
- return [state, setState];
+ return state;
}
export function usePosts(
diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx
index b4058fbe..d7e4d696 100644
--- a/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx
+++ b/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx
@@ -40,7 +40,7 @@ export default function TimelinePageTemplate<TManageItem>(
null
);
- const [timelineAndStatus, setTimelineAndStatus] = useTimeline(name);
+ const timelineAndStatus = useTimeline(name);
const postsAndState = usePosts(name);
const onPost: TimelinePostSendCallback = React.useCallback(
@@ -111,13 +111,6 @@ export default function TimelinePageTemplate<TManageItem>(
user != null
? () => {
const { isBookmark } = timeline;
- setTimelineAndStatus({
- ...timelineAndStatus,
- data: {
- ...timeline,
- isBookmark: !isBookmark,
- },
- });
const client = getHttpBookmarkClient();
const promise = isBookmark
? client.delete(name)
@@ -136,7 +129,6 @@ export default function TimelinePageTemplate<TManageItem>(
},
type: "danger",
});
- setTimelineAndStatus(timelineAndStatus);
}
);
}
@@ -145,13 +137,6 @@ export default function TimelinePageTemplate<TManageItem>(
user != null && user.hasHighlightTimelineAdministrationPermission
? () => {
const { isHighlight } = timeline;
- setTimelineAndStatus({
- ...timelineAndStatus,
- data: {
- ...timeline,
- isHighlight: !isHighlight,
- },
- });
const client = getHttpHighlightClient();
const promise = isHighlight
? client.delete(name)
@@ -170,7 +155,6 @@ export default function TimelinePageTemplate<TManageItem>(
},
type: "danger",
});
- setTimelineAndStatus(timelineAndStatus);
}
);
}