diff --git a/frontend/app/components/Dashboard/components/Alerts/NewAlert.tsx b/frontend/app/components/Dashboard/components/Alerts/NewAlert.tsx index 97319e938..717c7ea59 100644 --- a/frontend/app/components/Dashboard/components/Alerts/NewAlert.tsx +++ b/frontend/app/components/Dashboard/components/Alerts/NewAlert.tsx @@ -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) } diff --git a/frontend/app/duck/user.js b/frontend/app/duck/user.js index d938c8c09..f7f4e6a08 100644 --- a/frontend/app/duck/user.js +++ b/frontend/app/duck/user.js @@ -143,7 +143,7 @@ export const fetchUserInfo = () => ({ export function logout() { return { types: DELETE.toArray(), - call: client => client.post('/logout') + call: client => client.get('/logout') }; } diff --git a/frontend/app/types/alert.ts b/frontend/app/types/alert.ts index 052de7c1d..a9600d024 100644 --- a/frontend/app/types/alert.ts +++ b/frontend/app/types/alert.ts @@ -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 = defaults, isExists: boolean) { + constructor(item: Partial = {}, isExists: boolean) { + const defaults = getDefaults() Object.assign(defaults, item) const options = defaults.options || { currentPeriod: 15, previousPeriod: 15, message: [] };