web-interface.assets.1255d548-7604.afd18abb1d666472790c.js.map Maven / Gradle / Ivy
{"version":3,"file":"1255d548-7604.afd18abb1d666472790c.js","mappings":"qRAmEA,QA3CkB,IAAM,CACtB,KAAM,CAAE,YAAAA,CAAY,KAAI,KAAS,GAAgB,EAC3CC,EAAY,CAACD,EACbE,KAAU,KAAW,EAErBC,KAAW,eAAaC,GAAiB,CAC7CF,EAAQ,QAAQE,CAAI,CACtB,EAAG,CAACF,CAAO,CAAC,EAENG,KAAsB,eAAY,IAAM,CAC5C,MAAMC,EAAYN,GAAA,YAAAA,EAAa,UAG/B,GAAIM,IAAc,MAAQ,OAAO,KAAKA,CAAS,EAAE,OAAS,EAAG,CACvDA,EAAU,OAAS,YACrBH,EAAS,KAAO,eAAeG,EAAU,EAAE,CAAC,EACnCA,EAAU,OAAS,SAC5BH,EAAS,KAAO,cAAcG,EAAU,EAAE,CAAC,EAClCA,EAAU,KAAO,UAC1BH,EAAS,KAAO,kBAAkBG,EAAU,EAAE,CAAC,EAE/CH,EAAS,KAAO,MAAM,EAGxB,MACF,CAEAA,EAAS,KAAO,OAAO,CACzB,EAAG,CAACH,GAAA,YAAAA,EAAa,UAAWG,CAAQ,CAAC,EAErC,sBAAU,IAAM,CACd,IAAiB,OAAO,CAC1B,EAAG,CAAC,CAAC,KAEL,aAAU,IAAM,CACTF,GACHI,EAAoB,CAExB,EAAG,CAACJ,EAAWI,CAAmB,CAAC,EAE5B,gBAAC,KAAO,IAAC,CAClB,C","sources":["webpack://graylog-web-interface/./src/pages/StartPage.tsx"],"sourcesContent":["/*\n * Copyright (C) 2020 Graylog, Inc.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the Server Side Public License, version 1,\n * as published by MongoDB, Inc.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * Server Side Public License for more details.\n *\n * You should have received a copy of the Server Side Public License\n * along with this program. If not, see\n * .\n */\nimport React, { useCallback, useEffect } from 'react';\n\nimport { Spinner } from 'components/common';\nimport Routes from 'routing/Routes';\nimport { CurrentUserStore } from 'stores/users/CurrentUserStore';\nimport { useStore } from 'stores/connect';\nimport useHistory from 'routing/useHistory';\n\nconst StartPage = () => {\n const { currentUser } = useStore(CurrentUserStore);\n const isLoading = !currentUser;\n const history = useHistory();\n\n const redirect = useCallback((page: string) => {\n history.replace(page);\n }, [history]);\n\n const redirectToStartPage = useCallback(() => {\n const startPage = currentUser?.startpage;\n\n // Show custom startpage if it was set\n if (startPage !== null && Object.keys(startPage).length > 0) {\n if (startPage.type === 'dashboard') {\n redirect(Routes.dashboard_show(startPage.id));\n } else if (startPage.type === 'stream') {\n redirect(Routes.stream_search(startPage.id));\n } else if (startPage.id !== 'default') {\n redirect(Routes.show_saved_search(startPage.id));\n } else {\n redirect(Routes.SEARCH);\n }\n\n return;\n }\n\n redirect(Routes.WELCOME);\n }, [currentUser?.startpage, redirect]);\n\n useEffect(() => {\n CurrentUserStore.reload();\n }, []);\n\n useEffect(() => {\n if (!isLoading) {\n redirectToStartPage();\n }\n }, [isLoading, redirectToStartPage]);\n\n return ;\n};\n\nexport default StartPage;\n"],"names":["currentUser","isLoading","history","redirect","page","redirectToStartPage","startPage"],"sourceRoot":""}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy