change(ui): fix alert reset, logout

This commit is contained in:
nick-delirium 2023-02-02 18:55:55 +01:00 committed by Taha Yassine Kraiem
parent 774f14d40e
commit 34a0285904
3 changed files with 6 additions and 6 deletions

View file

@ -94,8 +94,7 @@ const NewAlert = (props: IProps) => {
useEffect(() => {
if (list.length > 0) {
const alertId = location.pathname.split('/').pop();
const currentAlert = list
.find((alert: Alert) => alert.alertId === String(alertId));
const currentAlert = list.find((alert: Alert) => alert.alertId === String(alertId));
if (currentAlert) {
init(currentAlert)
}

View file

@ -143,7 +143,7 @@ export const fetchUserInfo = () => ({
export function logout() {
return {
types: DELETE.toArray(),
call: client => client.post('/logout')
call: client => client.get('/logout')
};
}

View file

@ -36,7 +36,7 @@ export interface IAlert {
condition: string;
}
const defaults = {
const getDefaults = () => ({
alertId: '',
projectId: undefined,
name: 'Untitled Alert',
@ -61,7 +61,7 @@ const defaults = {
hasNotification: false,
metric: '',
condition: '',
} as unknown as IAlert
}) as unknown as IAlert
export default class Alert {
alertId: IAlert["alertId"]
@ -90,7 +90,8 @@ export default class Alert {
condition: IAlert["condition"]
isExists = false
constructor(item: Partial<IAlert> = defaults, isExists: boolean) {
constructor(item: Partial<IAlert> = {}, isExists: boolean) {
const defaults = getDefaults()
Object.assign(defaults, item)
const options = defaults.options || { currentPeriod: 15, previousPeriod: 15, message: [] };