Skip to content

Commit

Permalink
chore: delete console.debug in display-store (#5200)
Browse files Browse the repository at this point in the history
* chore: delete console.debug in display-store

Signed-off-by: yuda <[email protected]>

* refactor: replace console.error with errorHandler

Signed-off-by: yuda <[email protected]>

---------

Signed-off-by: yuda <[email protected]>
  • Loading branch information
yuda110 authored Dec 10, 2024
1 parent 9593a33 commit b747cf6
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions apps/web/src/store/display/display-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,9 @@ export const useDisplayStore = defineStore('display-store', () => {
let notificationListApiToken: CancelTokenSource | undefined;
const checkNotification = async (): Promise<void> => {
if (notificationListApiToken) {
console.debug('[CHECK NOTI]', ' pending...');
return;
}
try {
console.debug('[CHECK NOTI]', ' start');
notificationListApiToken = axios.CancelToken.source();

const currentTime = dayjs.tz(dayjs.utc(), userStore.state.timezone);
Expand All @@ -232,7 +230,6 @@ export const useDisplayStore = defineStore('display-store', () => {
currentTime,
lastNotificationReadTime,
);
console.debug('[NOTI QUERY.FILTER]', param.query.filter);
const { total_count } = await SpaceConnector.clientV2.notification.notification.list<NotificationListParameters, ListResponse<NotificationModel>>(param, {
cancelToken: notificationListApiToken.token,
});
Expand All @@ -246,36 +243,30 @@ export const useDisplayStore = defineStore('display-store', () => {
}
} finally {
notificationListApiToken = undefined;
console.debug('[CHECK NOTI]', ' finished');
}
};

let checkNotificationInterval: undefined|ReturnType<typeof setTimeout>;
const stopCheckNotification = (): void => {
if (notificationListApiToken) {
console.debug('[NOTI API]', 'canceled');
notificationListApiToken.cancel();
notificationListApiToken = undefined;
}

if (checkNotificationInterval) {
console.debug('[NOTI INTERVAL]', 'stopped');
clearInterval(checkNotificationInterval);
checkNotificationInterval = undefined;
}
};

const startCheckNotification = (): void => {
if (notificationListApiToken) {
console.debug('[NOTI API]', 'previous canceled');
notificationListApiToken.cancel();
notificationListApiToken = undefined;
}
if (checkNotificationInterval) {
console.debug('[NOTI INTERVAL]', 'previous stopped');
clearInterval(checkNotificationInterval);
} else {
console.debug('[NOTI INTERVAL]', 'start');
checkNotification();
}

Expand All @@ -293,7 +284,7 @@ export const useDisplayStore = defineStore('display-store', () => {
state.gnbNotificationLastReadTime = settings.global.gnbNotificationLastReadTime;
}
} catch (e) {
console.error(e);
ErrorHandler.handleError(e);
LocalStorageAccessor.removeItem(userId);
}
};
Expand Down

0 comments on commit b747cf6

Please sign in to comment.