mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor: define ResourceInfo type for improved type safety in resource info retrieval
This commit is contained in:
@@ -251,12 +251,14 @@ export default class UserNotificationLogTimelineAPI extends BaseAPI<
|
||||
const httpProtocol: Protocol = await DatabaseConfig.getHttpProtocol();
|
||||
|
||||
// Determine the resource type and ID for routing
|
||||
const getResourceInfo = (): {
|
||||
type ResourceInfo = {
|
||||
type: string;
|
||||
path: string;
|
||||
id: ObjectID;
|
||||
title: string;
|
||||
} => {
|
||||
};
|
||||
|
||||
const getResourceInfo: () => ResourceInfo = (): ResourceInfo => {
|
||||
if (timelineItem.triggeredByIncidentId) {
|
||||
return {
|
||||
type: "Incident",
|
||||
@@ -284,7 +286,7 @@ export default class UserNotificationLogTimelineAPI extends BaseAPI<
|
||||
return { type: "", path: "", id: new ObjectID(""), title: "" };
|
||||
};
|
||||
|
||||
const resourceInfo = getResourceInfo();
|
||||
const resourceInfo: ResourceInfo = getResourceInfo();
|
||||
|
||||
if (timelineItem.isAcknowledged) {
|
||||
// already acknowledged. Then show already acknowledged page with view details button.
|
||||
|
||||
Reference in New Issue
Block a user