Commit 7f0c1ae3 authored by Mathias Engelbrecht Pilegård's avatar Mathias Engelbrecht Pilegård
Browse files

added ability to remove account from account page

parent a26e7d3e
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\confirmRemoveAccountModal\\\\ConfirmRemoveAccountModal.jsx\",\n _s = $RefreshSig$();\n\nimport React from 'react';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./ConfirmRemoveAccountModal.css\";\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst ConfirmRemoveAccountModal = ({\n removeModal,\n headerMessage,\n bodyMessage\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n\n const stopProp = e => {\n e.stopPropagation();\n };\n\n useEffect(() => {\n if (!authState.isAuthenticated) {\n // When user isn't authenticated, forget any user info\n setUserInfo(null);\n } else {\n oktaAuth.getUser().then(info => {\n setUserInfo(info);\n });\n }\n }, [authState, oktaAuth]); // Update if authState changes\n // const removeAccountRequestOptions = {\n // method: 'POST',\n // body:\n // userInfo && (\n // JSON.stringify(\n // {\n // email: userInfo.email\n // }\n // )\n // )\n // }\n // const handleRemoveAccount = () => {\n // fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions)\n // .then((res) => {\n // if (!res.ok) {\n // window.alert(\"Error\")\n // Promise.reject(\"\")\n // return\n // }\n // if (res.ok) {\n // // oktaAuth.signOut()\n // }\n // })\n // }\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"confirmRemoveAccountModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Delete account\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 53,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"Are you sure you want to delete your account?\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 54,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"No\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 58,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n children: \"Yes\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 61,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 57,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 52,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 51,\n columnNumber: 5\n }, this);\n};\n\n_s(ConfirmRemoveAccountModal, \"/7FunoA1ejJNU8uKGTy1GZFqU2I=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = ConfirmRemoveAccountModal;\nexport default ConfirmRemoveAccountModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"ConfirmRemoveAccountModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/confirmRemoveAccountModal/ConfirmRemoveAccountModal.jsx"],"names":["React","useOktaAuth","ConfirmRemoveAccountModal","removeModal","headerMessage","bodyMessage","authState","oktaAuth","userInfo","setUserInfo","useState","stopProp","e","stopPropagation","useEffect","isAuthenticated","getUser","then","info"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,iCAAP;;;AAEA,MAAMC,yBAAyB,GAAG,CAAC;AAAEC,EAAAA,WAAF;AAAeC,EAAAA,aAAf;AAA8BC,EAAAA;AAA9B,CAAD,KAAiD;AAAA;;AACjF,QAAM;AAAEC,IAAAA,SAAF;AAAaC,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,yB;AAiEN,eAAeA,yBAAf","sourcesContent":["import React from 'react'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./ConfirmRemoveAccountModal.css\"\r\n\r\nconst ConfirmRemoveAccountModal = ({ removeModal, headerMessage, bodyMessage }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n\r\n const stopProp = e => {\r\n e.stopPropagation()\r\n }\r\n\r\n useEffect(() => {\r\n if (!authState.isAuthenticated) {\r\n // When user isn't authenticated, forget any user info\r\n setUserInfo(null);\r\n } else {\r\n oktaAuth.getUser().then(info => {\r\n setUserInfo(info);\r\n });\r\n }\r\n }, [authState, oktaAuth]); // Update if authState changes\r\n\r\n // const removeAccountRequestOptions = {\r\n // method: 'POST',\r\n // body:\r\n // userInfo && (\r\n // JSON.stringify(\r\n // {\r\n // email: userInfo.email\r\n // }\r\n // )\r\n // )\r\n // }\r\n\r\n // const handleRemoveAccount = () => {\r\n // fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions)\r\n // .then((res) => {\r\n // if (!res.ok) {\r\n // window.alert(\"Error\")\r\n // Promise.reject(\"\")\r\n // return\r\n // }\r\n // if (res.ok) {\r\n // // oktaAuth.signOut()\r\n // }\r\n // })\r\n // }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"confirmRemoveAccountModal\">\r\n <h2>Delete account</h2>\r\n <label>\r\n Are you sure you want to delete your account?\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n No\r\n </button>\r\n <button className=\"yesButton\">\r\n Yes\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default ConfirmRemoveAccountModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\confirmRemoveAccountModal\\\\ConfirmRemoveAccountModal.jsx\";\nimport React from 'react';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst ConfirmRemoveAccountModal = ({\n removeModal,\n headerMessage,\n bodyMessage\n}) => {\n const stopProp = e => {\n e.stopPropagation();\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n onClick: e => removeModal(),\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"confirmRemoveAccountModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Delete account\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 11,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"You are about to delete your account. Are you sure?\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 12,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n children: \"Yes\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 15,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"No\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 18,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 10,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 9,\n columnNumber: 5\n }, this);\n};\n\n_c = ConfirmRemoveAccountModal;\nexport default ConfirmRemoveAccountModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"ConfirmRemoveAccountModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/confirmRemoveAccountModal/ConfirmRemoveAccountModal.jsx"],"names":["React","ConfirmRemoveAccountModal","removeModal","headerMessage","bodyMessage","stopProp","e","stopPropagation"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;;;AAEA,MAAMC,yBAAyB,GAAG,CAAC;AAAEC,EAAAA,WAAF;AAAeC,EAAAA,aAAf;AAA8BC,EAAAA;AAA9B,CAAD,KAAiD;AACjF,QAAMC,QAAQ,GAAGC,CAAC,IAAI;AACpBA,IAAAA,CAAC,CAACC,eAAF;AACD,GAFD;;AAIA,sBACE;AAAK,IAAA,SAAS,EAAC,eAAf;AAA+B,IAAA,OAAO,EAAED,CAAC,IAAIJ,WAAW,EAAxD;AAAA,2BACE;AAAK,MAAA,SAAS,EAAC,2BAAf;AAAA,8BACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cADF,eAEE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAFF,eAKE;AAAQ,QAAA,SAAS,EAAC,WAAlB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cALF,eAQE;AAAQ,QAAA,SAAS,EAAC,UAAlB;AAA6B,QAAA,OAAO,EAAEI,CAAC,IAAIJ,WAAW,EAAtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cARF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAgBD,CArBD;;KAAMD,yB;AAuBN,eAAeA,yBAAf","sourcesContent":["import React from 'react'\r\n\r\nconst ConfirmRemoveAccountModal = ({ removeModal, headerMessage, bodyMessage }) => {\r\n const stopProp = e => {\r\n e.stopPropagation()\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\" onClick={e => removeModal()}>\r\n <div className=\"confirmRemoveAccountModal\">\r\n <h2>Delete account</h2>\r\n <label>\r\n You are about to delete your account. Are you sure?\r\n </label>\r\n <button className=\"yesButton\">\r\n Yes\r\n </button>\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n No\r\n </button>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default ConfirmRemoveAccountModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\confirmRemoveAccountModal\\\\ConfirmRemoveAccountModal.jsx\";\nimport React from 'react';\nimport \"./ConfirmRemoveAccountModal.css\";\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst ConfirmRemoveAccountModal = ({\n removeModal,\n headerMessage,\n bodyMessage\n}) => {\n const stopProp = e => {\n e.stopPropagation();\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n onClick: e => removeModal(),\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"confirmRemoveAccountModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Delete account\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 12,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"Are you sure you want to delete your account?\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 13,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n children: \"Yes\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 17,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"No\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 20,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 16,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 11,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 10,\n columnNumber: 5\n }, this);\n};\n\n_c = ConfirmRemoveAccountModal;\nexport default ConfirmRemoveAccountModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"ConfirmRemoveAccountModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/confirmRemoveAccountModal/ConfirmRemoveAccountModal.jsx"],"names":["React","ConfirmRemoveAccountModal","removeModal","headerMessage","bodyMessage","stopProp","e","stopPropagation"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAO,iCAAP;;;AAEA,MAAMC,yBAAyB,GAAG,CAAC;AAAEC,EAAAA,WAAF;AAAeC,EAAAA,aAAf;AAA8BC,EAAAA;AAA9B,CAAD,KAAiD;AACjF,QAAMC,QAAQ,GAAGC,CAAC,IAAI;AACpBA,IAAAA,CAAC,CAACC,eAAF;AACD,GAFD;;AAIA,sBACE;AAAK,IAAA,SAAS,EAAC,eAAf;AAA+B,IAAA,OAAO,EAAED,CAAC,IAAIJ,WAAW,EAAxD;AAAA,2BACE;AAAK,MAAA,SAAS,EAAC,2BAAf;AAAA,8BACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cADF,eAEE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAFF,eAKE;AAAK,QAAA,SAAS,EAAC,iBAAf;AAAA,gCACE;AAAQ,UAAA,SAAS,EAAC,WAAlB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBADF,eAIE;AAAQ,UAAA,SAAS,EAAC,UAAlB;AAA6B,UAAA,OAAO,EAAEI,CAAC,IAAIJ,WAAW,EAAtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAJF;AAAA;AAAA;AAAA;AAAA;AAAA,cALF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAkBD,CAvBD;;KAAMD,yB;AAyBN,eAAeA,yBAAf","sourcesContent":["import React from 'react'\r\nimport \"./ConfirmRemoveAccountModal.css\"\r\n\r\nconst ConfirmRemoveAccountModal = ({ removeModal, headerMessage, bodyMessage }) => {\r\n const stopProp = e => {\r\n e.stopPropagation()\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\" onClick={e => removeModal()}>\r\n <div className=\"confirmRemoveAccountModal\">\r\n <h2>Delete account</h2>\r\n <label>\r\n Are you sure you want to delete your account?\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"yesButton\">\r\n Yes\r\n </button>\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n No\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default ConfirmRemoveAccountModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\confirmRemoveAccountModal\\\\ConfirmRemoveAccountModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useEffect, useState } from 'react';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./ConfirmRemoveAccountModal.css\";\nimport config from '../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst ConfirmRemoveAccountModal = ({\n removeModal,\n headerMessage,\n bodyMessage\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n\n const stopProp = e => {\n e.stopPropagation();\n };\n\n useEffect(() => {\n if (!authState.isAuthenticated) {\n // When user isn't authenticated, forget any user info\n setUserInfo(null);\n } else {\n oktaAuth.getUser().then(info => {\n setUserInfo(info);\n });\n }\n }, [authState, oktaAuth]); // Update if authState changes\n\n const removeAccountRequestOptions = {\n method: 'POST',\n body: userInfo && JSON.stringify({\n email: userInfo.email\n })\n };\n\n const handleRemoveAccount = () => {\n fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions).then(res => {\n if (!res.ok) {\n console.log(res);\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n oktaAuth.signOut();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"confirmRemoveAccountModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Delete account\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 55,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"Are you sure you want to delete your account?\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 56,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"No\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 60,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n onClick: handleRemoveAccount,\n children: \"Yes\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 63,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 59,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 54,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 53,\n columnNumber: 5\n }, this);\n};\n\n_s(ConfirmRemoveAccountModal, \"/7FunoA1ejJNU8uKGTy1GZFqU2I=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = ConfirmRemoveAccountModal;\nexport default ConfirmRemoveAccountModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"ConfirmRemoveAccountModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/confirmRemoveAccountModal/ConfirmRemoveAccountModal.jsx"],"names":["React","useEffect","useState","useOktaAuth","config","ConfirmRemoveAccountModal","removeModal","headerMessage","bodyMessage","authState","oktaAuth","userInfo","setUserInfo","stopProp","e","stopPropagation","isAuthenticated","getUser","then","info","removeAccountRequestOptions","method","body","JSON","stringify","email","handleRemoveAccount","fetch","serviceAPI","removeAccountURL","res","ok","console","log","window","alert","Promise","reject","signOut"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,iCAAP;AACA,OAAOC,MAAP,MAAmB,cAAnB;;;AAEA,MAAMC,yBAAyB,GAAG,CAAC;AAAEC,EAAAA,WAAF;AAAeC,EAAAA,aAAf;AAA8BC,EAAAA;AAA9B,CAAD,KAAiD;AAAA;;AACjF,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BP,WAAW,EAA3C;AACA,QAAM,CAACQ,QAAD,EAAWC,WAAX,IAA0BV,QAAQ,CAAC,IAAD,CAAxC;;AAEA,QAAMW,QAAQ,GAAGC,CAAC,IAAI;AACpBA,IAAAA,CAAC,CAACC,eAAF;AACD,GAFD;;AAIAd,EAAAA,SAAS,CAAC,MAAM;AACd,QAAI,CAACQ,SAAS,CAACO,eAAf,EAAgC;AAC9B;AACAJ,MAAAA,WAAW,CAAC,IAAD,CAAX;AACD,KAHD,MAGO;AACLF,MAAAA,QAAQ,CAACO,OAAT,GAAmBC,IAAnB,CAAwBC,IAAI,IAAI;AAC9BP,QAAAA,WAAW,CAACO,IAAD,CAAX;AACD,OAFD;AAGD;AACF,GATQ,EASN,CAACV,SAAD,EAAYC,QAAZ,CATM,CAAT,CARiF,CAiBtD;;AAE3B,QAAMU,2BAA2B,GAAG;AAClCC,IAAAA,MAAM,EAAE,MAD0B;AAElCC,IAAAA,IAAI,EACFX,QAAQ,IACNY,IAAI,CAACC,SAAL,CACE;AACEC,MAAAA,KAAK,EAAEd,QAAQ,CAACc;AADlB,KADF;AAJ8B,GAApC;;AAYA,QAAMC,mBAAmB,GAAG,MAAM;AAChCC,IAAAA,KAAK,CAACvB,MAAM,CAACwB,UAAP,CAAkBC,gBAAnB,EAAqCT,2BAArC,CAAL,CACGF,IADH,CACSY,GAAD,IAAS;AACb,UAAI,CAACA,GAAG,CAACC,EAAT,EAAa;AACXC,QAAAA,OAAO,CAACC,GAAR,CAAYH,GAAZ;AACAI,QAAAA,MAAM,CAACC,KAAP,CAAa,OAAb;AACAC,QAAAA,OAAO,CAACC,MAAR,CAAe,EAAf;AACA;AACD;;AACD,UAAIP,GAAG,CAACC,EAAR,EAAY;AACVrB,QAAAA,QAAQ,CAAC4B,OAAT;AACD;AACF,KAXH;AAYD,GAbD;;AAeA,sBACE;AAAK,IAAA,SAAS,EAAC,eAAf;AAAA,2BACE;AAAK,MAAA,SAAS,EAAC,2BAAf;AAAA,8BACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cADF,eAEE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAFF,eAKE;AAAK,QAAA,SAAS,EAAC,iBAAf;AAAA,gCACE;AAAQ,UAAA,SAAS,EAAC,UAAlB;AAA6B,UAAA,OAAO,EAAExB,CAAC,IAAIR,WAAW,EAAtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBADF,eAIE;AAAQ,UAAA,SAAS,EAAC,WAAlB;AAA8B,UAAA,OAAO,EAAEoB,mBAAvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAJF;AAAA;AAAA;AAAA;AAAA;AAAA,cALF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAkBD,CAhED;;GAAMrB,yB;UAC4BF,W;;;KAD5BE,yB;AAkEN,eAAeA,yBAAf","sourcesContent":["import React, { useEffect, useState } from 'react'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./ConfirmRemoveAccountModal.css\"\r\nimport config from '../../config';\r\n\r\nconst ConfirmRemoveAccountModal = ({ removeModal, headerMessage, bodyMessage }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n\r\n const stopProp = e => {\r\n e.stopPropagation()\r\n }\r\n\r\n useEffect(() => {\r\n if (!authState.isAuthenticated) {\r\n // When user isn't authenticated, forget any user info\r\n setUserInfo(null);\r\n } else {\r\n oktaAuth.getUser().then(info => {\r\n setUserInfo(info);\r\n });\r\n }\r\n }, [authState, oktaAuth]); // Update if authState changes\r\n\r\n const removeAccountRequestOptions = {\r\n method: 'POST',\r\n body:\r\n userInfo && (\r\n JSON.stringify(\r\n {\r\n email: userInfo.email\r\n }\r\n )\r\n )\r\n }\r\n\r\n const handleRemoveAccount = () => {\r\n fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n console.log(res)\r\n window.alert(\"Error\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n oktaAuth.signOut()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"confirmRemoveAccountModal\">\r\n <h2>Delete account</h2>\r\n <label>\r\n Are you sure you want to delete your account?\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n No\r\n </button>\r\n <button className=\"yesButton\" onClick={handleRemoveAccount}>\r\n Yes\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default ConfirmRemoveAccountModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\confirmRemoveAccountModal\\\\ConfirmRemoveAccountModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useEffect, useState } from 'react';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./ConfirmRemoveAccountModal.css\";\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst ConfirmRemoveAccountModal = ({\n removeModal,\n headerMessage,\n bodyMessage\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n\n const stopProp = e => {\n e.stopPropagation();\n };\n\n useEffect(() => {\n if (!authState.isAuthenticated) {\n // When user isn't authenticated, forget any user info\n setUserInfo(null);\n } else {\n oktaAuth.getUser().then(info => {\n setUserInfo(info);\n });\n }\n }, [authState, oktaAuth]); // Update if authState changes\n\n const removeAccountRequestOptions = {\n method: 'POST',\n body: userInfo && JSON.stringify({\n email: userInfo.email\n })\n };\n\n const handleRemoveAccount = () => {\n fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n oktaAuth.signOut();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"confirmRemoveAccountModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Delete account\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 53,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"Are you sure you want to delete your account?\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 54,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"No\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 58,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n onClick: handleRemoveAccount,\n children: \"Yes\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 61,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 57,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 52,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 51,\n columnNumber: 5\n }, this);\n};\n\n_s(ConfirmRemoveAccountModal, \"/7FunoA1ejJNU8uKGTy1GZFqU2I=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = ConfirmRemoveAccountModal;\nexport default ConfirmRemoveAccountModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"ConfirmRemoveAccountModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/confirmRemoveAccountModal/ConfirmRemoveAccountModal.jsx"],"names":["React","useEffect","useState","useOktaAuth","ConfirmRemoveAccountModal","removeModal","headerMessage","bodyMessage","authState","oktaAuth","userInfo","setUserInfo","stopProp","e","stopPropagation","isAuthenticated","getUser","then","info","removeAccountRequestOptions","method","body","JSON","stringify","email","handleRemoveAccount","fetch","config","serviceAPI","removeAccountURL","res","ok","window","alert","Promise","reject","signOut"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,iCAAP;;;AAEA,MAAMC,yBAAyB,GAAG,CAAC;AAAEC,EAAAA,WAAF;AAAeC,EAAAA,aAAf;AAA8BC,EAAAA;AAA9B,CAAD,KAAiD;AAAA;;AACjF,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BN,WAAW,EAA3C;AACA,QAAM,CAACO,QAAD,EAAWC,WAAX,IAA0BT,QAAQ,CAAC,IAAD,CAAxC;;AAEA,QAAMU,QAAQ,GAAGC,CAAC,IAAI;AACpBA,IAAAA,CAAC,CAACC,eAAF;AACD,GAFD;;AAIAb,EAAAA,SAAS,CAAC,MAAM;AACd,QAAI,CAACO,SAAS,CAACO,eAAf,EAAgC;AAC9B;AACAJ,MAAAA,WAAW,CAAC,IAAD,CAAX;AACD,KAHD,MAGO;AACLF,MAAAA,QAAQ,CAACO,OAAT,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AAAA;AAAA;AAAA,cALF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAkBD,CA/DD;;GAAMrB,yB;UAC4BD,W;;;KAD5BC,yB;AAiEN,eAAeA,yBAAf","sourcesContent":["import React, { useEffect, useState } from 'react'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./ConfirmRemoveAccountModal.css\"\r\n\r\nconst ConfirmRemoveAccountModal = ({ removeModal, headerMessage, bodyMessage }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n\r\n const stopProp = e => {\r\n e.stopPropagation()\r\n }\r\n\r\n useEffect(() => {\r\n if (!authState.isAuthenticated) {\r\n // When user isn't authenticated, forget any user info\r\n setUserInfo(null);\r\n } else {\r\n oktaAuth.getUser().then(info => {\r\n setUserInfo(info);\r\n });\r\n }\r\n }, [authState, oktaAuth]); // Update if authState changes\r\n\r\n const removeAccountRequestOptions = {\r\n method: 'POST',\r\n body:\r\n userInfo && (\r\n JSON.stringify(\r\n {\r\n email: userInfo.email\r\n }\r\n )\r\n )\r\n }\r\n\r\n const handleRemoveAccount = () => {\r\n fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n oktaAuth.signOut()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"confirmRemoveAccountModal\">\r\n <h2>Delete account</h2>\r\n <label>\r\n Are you sure you want to delete your account?\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n No\r\n </button>\r\n <button className=\"yesButton\" onClick={handleRemoveAccount}>\r\n Yes\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default ConfirmRemoveAccountModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\confirmRemoveAccountModal\\\\ConfirmRemoveAccountModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useEffect, useState } from 'react';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./ConfirmRemoveAccountModal.css\";\nimport config from '../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst ConfirmRemoveAccountModal = ({\n removeModal,\n headerMessage,\n bodyMessage\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n\n const stopProp = e => {\n e.stopPropagation();\n };\n\n useEffect(() => {\n if (!authState.isAuthenticated) {\n // When user isn't authenticated, forget any user info\n setUserInfo(null);\n } else {\n oktaAuth.getUser().then(info => {\n setUserInfo(info);\n });\n }\n }, [authState, oktaAuth]); // Update if authState changes\n\n const userData = JSON.stringify({\n email: `${userInfo && userInfo.email}`\n });\n const removeAccountRequestOptions = {\n method: 'DELETE',\n body: userData\n };\n\n const handleRemoveAccount = () => {\n console.log(removeAccountRequestOptions.body);\n fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions).then(res => {\n if (!res.ok) {\n console.log(res);\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n oktaAuth.signOut();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"confirmRemoveAccountModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Delete account\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 53,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"Are you sure you want to delete your account?\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 54,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"No\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 58,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n onClick: handleRemoveAccount,\n children: \"Yes\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 61,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 57,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 52,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 51,\n columnNumber: 5\n }, this);\n};\n\n_s(ConfirmRemoveAccountModal, \"/7FunoA1ejJNU8uKGTy1GZFqU2I=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = ConfirmRemoveAccountModal;\nexport default ConfirmRemoveAccountModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"ConfirmRemoveAccountModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/confirmRemoveAccountModal/ConfirmRemoveAccountModal.jsx"],"names":["React","useEffect","useState","useOktaAuth","config","ConfirmRemoveAccountModal","removeModal","headerMessage","bodyMessage","authState","oktaAuth","userInfo","setUserInfo","stopProp","e","stopPropagation","isAuthenticated","getUser","then","info","userData","JSON","stringify","email","removeAccountRequestOptions","method","body","handleRemoveAccount","console","log","fetch","serviceAPI","removeAccountURL","res","ok","window","alert","Promise","reject","signOut"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,iCAAP;AACA,OAAOC,MAAP,MAAmB,cAAnB;;;AAEA,MAAMC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AACC,KAAP,CAAa,OAAb;AACAC,QAAAA,OAAO,CAACC,MAAR,CAAe,EAAf;AACA;AACD;;AACD,UAAIL,GAAG,CAACC,EAAR,EAAY;AACVxB,QAAAA,QAAQ,CAAC6B,OAAT;AACD;AACF,KAXH;AAYD,GAdD;;AAgBA,sBACE;AAAK,IAAA,SAAS,EAAC,eAAf;AAAA,2BACE;AAAK,MAAA,SAAS,EAAC,2BAAf;AAAA,8BACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cADF,eAEE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAFF,eAKE;AAAK,QAAA,SAAS,EAAC,iBAAf;AAAA,gCACE;AAAQ,UAAA,SAAS,EAAC,UAAlB;AAA6B,UAAA,OAAO,EAAEzB,CAAC,IAAIR,WAAW,EAAtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBADF,eAIE;AAAQ,UAAA,SAAS,EAAC,WAAlB;AAA8B,UAAA,OAAO,EAAEqB,mBAAvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAJF;AAAA;AAAA;AAAA;AAAA;AAAA,cALF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAkBD,CA9DD;;GAAMtB,yB;UAC4BF,W;;;KAD5BE,yB;AAgEN,eAAeA,yBAAf","sourcesContent":["import React, { useEffect, useState } from 'react'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./ConfirmRemoveAccountModal.css\"\r\nimport config from '../../config';\r\n\r\nconst ConfirmRemoveAccountModal = ({ removeModal, headerMessage, bodyMessage }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n\r\n const stopProp = e => {\r\n e.stopPropagation()\r\n }\r\n\r\n useEffect(() => {\r\n if (!authState.isAuthenticated) {\r\n // When user isn't authenticated, forget any user info\r\n setUserInfo(null);\r\n } else {\r\n oktaAuth.getUser().then(info => {\r\n setUserInfo(info);\r\n });\r\n }\r\n }, [authState, oktaAuth]); // Update if authState changes\r\n\r\n const userData = JSON.stringify({\r\n email: `${userInfo && userInfo.email}`,\r\n })\r\n\r\n const removeAccountRequestOptions = {\r\n method: 'DELETE',\r\n body: userData\r\n }\r\n\r\n const handleRemoveAccount = () => {\r\n console.log(removeAccountRequestOptions.body)\r\n fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n console.log(res)\r\n window.alert(\"Error\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n oktaAuth.signOut()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"confirmRemoveAccountModal\">\r\n <h2>Delete account</h2>\r\n <label>\r\n Are you sure you want to delete your account?\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n No\r\n </button>\r\n <button className=\"yesButton\" onClick={handleRemoveAccount}>\r\n Yes\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default ConfirmRemoveAccountModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\confirmRemoveAccountModal\\\\ConfirmRemoveAccountModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useEffect, useState } from 'react';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./ConfirmRemoveAccountModal.css\";\nimport config from '../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst ConfirmRemoveAccountModal = ({\n removeModal,\n headerMessage,\n bodyMessage\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n\n const stopProp = e => {\n e.stopPropagation();\n };\n\n useEffect(() => {\n if (!authState.isAuthenticated) {\n // When user isn't authenticated, forget any user info\n setUserInfo(null);\n } else {\n oktaAuth.getUser().then(info => {\n setUserInfo(info);\n });\n }\n }, [authState, oktaAuth]); // Update if authState changes\n\n const removeAccountRequestOptions = {\n method: 'DELETE',\n body: JSON.stringify({\n email: `${userInfo && userInfo.email}`\n })\n };\n\n const handleRemoveAccount = () => {\n console.log(removeAccountRequestOptions.body);\n fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions).then(res => {\n if (!res.ok) {\n console.log(res);\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {// oktaAuth.signOut()\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"confirmRemoveAccountModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Delete account\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 53,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"Are you sure you want to delete your account?\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 54,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"No\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 58,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n onClick: handleRemoveAccount,\n children: \"Yes\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 61,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 57,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 52,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 51,\n columnNumber: 5\n }, this);\n};\n\n_s(ConfirmRemoveAccountModal, \"/7FunoA1ejJNU8uKGTy1GZFqU2I=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = ConfirmRemoveAccountModal;\nexport default ConfirmRemoveAccountModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"ConfirmRemoveAccountModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/confirmRemoveAccountModal/ConfirmRemoveAccountModal.jsx"],"names":["React","useEffect","useState","useOktaAuth","config","ConfirmRemoveAccountModal","removeModal","headerMessage","bodyMessage","authState","oktaAuth","userInfo","setUserInfo","stopProp","e","stopPropagation","isAuthenticated","getUser","then","info","removeAccountRequestOptions","method","body","JSON","stringify","email","handleRemoveAccount","console","log","fetch","serviceAPI","removeAccountURL","res","ok","window","alert","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,iCAAP;AACA,OAAOC,MAAP,MAAmB,cAAnB;;;AAEA,MAAMC,yBAAyB,GAAG,CAAC;AAAEC,EAAAA,WAAF;AAAeC,EAAAA,aAAf;AAA8BC,EAAAA;AAA9B,CAAD,KAAiD;AAAA;;AACjF,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BP,WAAW,EAA3C;AACA,QAAM,CAACQ,QAAD,EAAWC,WAAX,IAA0BV,QAAQ,CAAC,IAAD,CAAxC;;AAEA,QAAMW,QAAQ,GAAGC,CAAC,IAAI;AACpBA,IAAAA,CAAC,CAACC,eAAF;AACD,GAFD;;AAIAd,EAAAA,SAAS,CAAC,MAAM;AACd,QAAI,CAACQ,SAAS,CAACO,eAAf,EAAgC;AAC9B;AACAJ,MAAAA,WAAW,CAAC,IAAD,CAAX;AACD,KAHD,MAGO;AACLF,MAAAA,QAAQ,CAACO,OAAT,GAAmBC,IAAnB,CA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O,EAAEoB,mBAAvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAJF;AAAA;AAAA;AAAA;AAAA;AAAA,cALF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAkBD,CA9DD;;GAAMrB,yB;UAC4BF,W;;;KAD5BE,yB;AAgEN,eAAeA,yBAAf","sourcesContent":["import React, { useEffect, useState } from 'react'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./ConfirmRemoveAccountModal.css\"\r\nimport config from '../../config';\r\n\r\nconst ConfirmRemoveAccountModal = ({ removeModal, headerMessage, bodyMessage }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n\r\n const stopProp = e => {\r\n e.stopPropagation()\r\n }\r\n\r\n useEffect(() => {\r\n if (!authState.isAuthenticated) {\r\n // When user isn't authenticated, forget any user info\r\n setUserInfo(null);\r\n } else {\r\n oktaAuth.getUser().then(info => {\r\n setUserInfo(info);\r\n });\r\n }\r\n }, [authState, oktaAuth]); // Update if authState changes\r\n\r\n const removeAccountRequestOptions = {\r\n method: 'DELETE',\r\n body: JSON.stringify(\r\n {\r\n email: `${userInfo && userInfo.email}`,\r\n }\r\n )\r\n }\r\n\r\n const handleRemoveAccount = () => {\r\n console.log(removeAccountRequestOptions.body)\r\n fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n console.log(res)\r\n window.alert(\"Error\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n // oktaAuth.signOut()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"confirmRemoveAccountModal\">\r\n <h2>Delete account</h2>\r\n <label>\r\n Are you sure you want to delete your account?\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n No\r\n </button>\r\n <button className=\"yesButton\" onClick={handleRemoveAccount}>\r\n Yes\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default ConfirmRemoveAccountModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\confirmRemoveAccountModal\\\\ConfirmRemoveAccountModal.jsx\";\nimport React from 'react';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst ConfirmRemoveAccountModal = ({\n removeModal,\n headerMessage,\n bodyMessage\n}) => {\n const stopProp = e => {\n e.stopPropagation();\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n onClick: e => removeModal(),\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"confirmRemoveAccountModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Delete account\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 11,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"Are you sure you want to delete your account?\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 12,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n children: \"Yes\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 16,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"No\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 19,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 15,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 10,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 9,\n columnNumber: 5\n }, this);\n};\n\n_c = ConfirmRemoveAccountModal;\nexport default ConfirmRemoveAccountModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"ConfirmRemoveAccountModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/confirmRemoveAccountModal/ConfirmRemoveAccountModal.jsx"],"names":["React","ConfirmRemoveAccountModal","removeModal","headerMessage","bodyMessage","stopProp","e","stopPropagation"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;;;AAEA,MAAMC,yBAAyB,GAAG,CAAC;AAAEC,EAAAA,WAAF;AAAeC,EAAAA,aAAf;AAA8BC,EAAAA;AAA9B,CAAD,KAAiD;AACjF,QAAMC,QAAQ,GAAGC,CAAC,IAAI;AACpBA,IAAAA,CAAC,CAACC,eAAF;AACD,GAFD;;AAIA,sBACE;AAAK,IAAA,SAAS,EAAC,eAAf;AAA+B,IAAA,OAAO,EAAED,CAAC,IAAIJ,WAAW,EAAxD;AAAA,2BACE;AAAK,MAAA,SAAS,EAAC,2BAAf;AAAA,8BACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cADF,eAEE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAFF,eAKE;AAAK,QAAA,SAAS,EAAC,iBAAf;AAAA,gCACE;AAAQ,UAAA,SAAS,EAAC,WAAlB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBADF,eAIE;AAAQ,UAAA,SAAS,EAAC,UAAlB;AAA6B,UAAA,OAAO,EAAEI,CAAC,IAAIJ,WAAW,EAAtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAJF;AAAA;AAAA;AAAA;AAAA;AAAA,cALF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAkBD,CAvBD;;KAAMD,yB;AAyBN,eAAeA,yBAAf","sourcesContent":["import React from 'react'\r\n\r\nconst ConfirmRemoveAccountModal = ({ removeModal, headerMessage, bodyMessage }) => {\r\n const stopProp = e => {\r\n e.stopPropagation()\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\" onClick={e => removeModal()}>\r\n <div className=\"confirmRemoveAccountModal\">\r\n <h2>Delete account</h2>\r\n <label>\r\n Are you sure you want to delete your account?\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"yesButton\">\r\n Yes\r\n </button>\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n No\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default ConfirmRemoveAccountModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\confirmRemoveAccountModal\\\\ConfirmRemoveAccountModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useEffect, useState } from 'react';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./ConfirmRemoveAccountModal.css\";\nimport config from '../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst ConfirmRemoveAccountModal = ({\n removeModal,\n headerMessage,\n bodyMessage\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n\n const stopProp = e => {\n e.stopPropagation();\n };\n\n useEffect(() => {\n if (!authState.isAuthenticated) {\n // When user isn't authenticated, forget any user info\n setUserInfo(null);\n } else {\n oktaAuth.getUser().then(info => {\n setUserInfo(info);\n });\n }\n }, [authState, oktaAuth]); // Update if authState changes\n\n const removeAccountRequestOptions = {\n method: 'DELETE',\n body: userInfo && JSON.stringify({\n email: userInfo.email\n })\n };\n\n const handleRemoveAccount = () => {\n fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions).then(res => {\n if (!res.ok) {\n console.log(res);\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n oktaAuth.signOut();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"confirmRemoveAccountModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Delete account\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 55,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"Are you sure you want to delete your account?\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 56,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"No\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 60,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n onClick: handleRemoveAccount,\n children: \"Yes\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 63,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 59,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 54,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 53,\n columnNumber: 5\n }, this);\n};\n\n_s(ConfirmRemoveAccountModal, \"/7FunoA1ejJNU8uKGTy1GZFqU2I=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = ConfirmRemoveAccountModal;\nexport default ConfirmRemoveAccountModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"ConfirmRemoveAccountModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/confirmRemoveAccountModal/ConfirmRemoveAccountModal.jsx"],"names":["React","useEffect","useState","useOktaAuth","config","ConfirmRemoveAccountModal","removeModal","headerMessage","bodyMessage","authState","oktaAuth","userInfo","setUserInfo","stopProp","e","stopPropagation","isAuthenticated","getUser","then","info","removeAccountRequestOptions","method","body","JSON","stringify","email","handleRemoveAccount","fetch","serviceAPI","removeAccountURL","res","ok","console","log","window","alert","Promise","reject","signOut"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,iCAAP;AACA,OAAOC,MAAP,MAAmB,cAAnB;;;AAEA,MAAMC,yBAAyB,GAAG,CAAC;AAAEC,EAAAA,WAAF;AAAeC,EAAAA,aAAf;AAA8BC,EAAAA;AAA9B,CAAD,KAAiD;AAAA;;AACjF,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BP,WAAW,EAA3C;AACA,QAAM,CAACQ,QAAD,EAAWC,WAAX,IAA0BV,QAAQ,CAAC,IAAD,CAAxC;;AAEA,QAAMW,QAAQ,GAAGC,CAAC,IAAI;AACpBA,IAAAA,CAAC,CAACC,eAAF;AACD,GAFD;;AAIAd,EAAAA,SAAS,CAAC,MAAM;AACd,QAAI,CAACQ,SAAS,CAACO,eAAf,EAAgC;AAC9B;AACAJ,MAAAA,WAAW,CAAC,IAAD,CAAX;AACD,KAHD,MAGO;AACLF,MAAAA,QAAQ,CAACO,OAAT,GAAmBC,IAAnB,CAAwBC,IAAI,IAAI;AAC9BP,QAAAA,WAAW,CAACO,IAAD,CAAX;AACD,OAFD;AAGD;AACF,GATQ,EASN,CAACV,SAAD,EAAYC,QAAZ,CATM,CAAT,CARiF,CAiBtD;;AAE3B,QAAMU,2BAA2B,GAAG;AAClCC,IAAAA,MAAM,EAAE,QAD0B;AAElCC,IAAAA,IAAI,EACFX,QAAQ,IACNY,IAAI,CAACC,SAAL,CACE;AACEC,MAAAA,KAAK,EAAEd,QAAQ,CAACc;AADlB,KADF;AAJ8B,GAApC;;AAYA,QAAMC,mBAAmB,GAAG,MAAM;AAChCC,IAAAA,KAAK,CAACvB,MAAM,CAACwB,UAAP,CAAkBC,gBAAnB,EAAqCT,2BAArC,CAAL,CACGF,IADH,CACSY,GAAD,IAAS;AACb,UAAI,CAACA,GAAG,CAACC,EAAT,EAAa;AACXC,QAAAA,OAAO,CAACC,GAAR,CAAYH,GAAZ;AACAI,QAAAA,MAAM,CAACC,KAAP,CAAa,OAAb;AACAC,QAAAA,OAAO,CAACC,MAAR,CAAe,EAAf;AACA;AACD;;AACD,UAAIP,GAAG,CAACC,EAAR,EAAY;AACVrB,QAAAA,QAAQ,CAAC4B,OAAT;AACD;AACF,KAXH;AAYD,GAbD;;AAeA,sBACE;AAAK,IAAA,SAAS,EAAC,eAAf;AAAA,2BACE;AAAK,MAAA,SAAS,EAAC,2BAAf;AAAA,8BACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cADF,eAEE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAFF,eAKE;AAAK,QAAA,SAAS,EAAC,iBAAf;AAAA,gCACE;AAAQ,UAAA,SAAS,EAAC,UAAlB;AAA6B,UAAA,OAAO,EAAExB,CAAC,IAAIR,WAAW,EAAtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBADF,eAIE;AAAQ,UAAA,SAAS,EAAC,WAAlB;AAA8B,UAAA,OAAO,EAAEoB,mBAAvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAJF;AAAA;AAAA;AAAA;AAAA;AAAA,cALF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAkBD,CAhED;;GAAMrB,yB;UAC4BF,W;;;KAD5BE,yB;AAkEN,eAAeA,yBAAf","sourcesContent":["import React, { useEffect, useState } from 'react'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./ConfirmRemoveAccountModal.css\"\r\nimport config from '../../config';\r\n\r\nconst ConfirmRemoveAccountModal = ({ removeModal, headerMessage, bodyMessage }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n\r\n const stopProp = e => {\r\n e.stopPropagation()\r\n }\r\n\r\n useEffect(() => {\r\n if (!authState.isAuthenticated) {\r\n // When user isn't authenticated, forget any user info\r\n setUserInfo(null);\r\n } else {\r\n oktaAuth.getUser().then(info => {\r\n setUserInfo(info);\r\n });\r\n }\r\n }, [authState, oktaAuth]); // Update if authState changes\r\n\r\n const removeAccountRequestOptions = {\r\n method: 'DELETE',\r\n body:\r\n userInfo && (\r\n JSON.stringify(\r\n {\r\n email: userInfo.email\r\n }\r\n )\r\n )\r\n }\r\n\r\n const handleRemoveAccount = () => {\r\n fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n console.log(res)\r\n window.alert(\"Error\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n oktaAuth.signOut()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"confirmRemoveAccountModal\">\r\n <h2>Delete account</h2>\r\n <label>\r\n Are you sure you want to delete your account?\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n No\r\n </button>\r\n <button className=\"yesButton\" onClick={handleRemoveAccount}>\r\n Yes\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default ConfirmRemoveAccountModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\confirmRemoveAccountModal\\\\ConfirmRemoveAccountModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useEffect, useState } from 'react';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./ConfirmRemoveAccountModal.css\";\nimport config from '../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst ConfirmRemoveAccountModal = ({\n removeModal,\n headerMessage,\n bodyMessage\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n\n const stopProp = e => {\n e.stopPropagation();\n };\n\n useEffect(() => {\n if (!authState.isAuthenticated) {\n // When user isn't authenticated, forget any user info\n setUserInfo(null);\n } else {\n oktaAuth.getUser().then(info => {\n setUserInfo(info);\n });\n }\n }, [authState, oktaAuth]); // Update if authState changes\n\n const removeAccountRequestOptions = {\n method: 'DELETE',\n body: userInfo && JSON.stringify({\n email: `${userInfo.email}`\n })\n };\n\n const handleRemoveAccount = () => {\n console.log(userInfo); // fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions)\n // .then((res) => {\n // if (!res.ok) {\n // console.log(res)\n // window.alert(\"Error\")\n // Promise.reject(\"\")\n // return\n // }\n // if (res.ok) {\n // // oktaAuth.signOut()\n // }\n // })\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"confirmRemoveAccountModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Delete account\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 56,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"Are you sure you want to delete your account?\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 57,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"No\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 61,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n onClick: handleRemoveAccount,\n children: \"Yes\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 64,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 60,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 55,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 54,\n columnNumber: 5\n }, this);\n};\n\n_s(ConfirmRemoveAccountModal, \"/7FunoA1ejJNU8uKGTy1GZFqU2I=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = ConfirmRemoveAccountModal;\nexport default ConfirmRemoveAccountModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"ConfirmRemoveAccountModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/confirmRemoveAccountModal/ConfirmRemoveAccountModal.jsx"],"names":["React","useEffect","useState","useOktaAuth","config","ConfirmRemoveAccountModal","removeModal","headerMessage","bodyMessage","authState","oktaAuth","userInfo","setUserInfo","stopProp","e","stopPropagation","isAuthenticated","getUser","then","info","removeAccountRequestOptions","method","body","JSON","stringify","email","handleRemoveAccount","console","log"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,iCAAP;AACA,OAAOC,MAAP,MAAmB,cAAnB;;;AAEA,MAAMC,yBAAyB,GAAG,CAAC;AAAEC,EAAAA,WAAF;AAAeC,EAAAA,aAAf;AAA8BC,EAAAA;AAA9B,CAAD,KAAiD;AAAA;;AACjF,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BP,WAAW,EAA3C;AACA,QAAM,CAACQ,QAAD,EAAWC,WAAX,IAA0BV,QAAQ,CAAC,IAAD,CAAxC;;AAEA,QAAMW,QAAQ,GAAGC,CAAC,IAAI;AACpBA,IAAAA,CAAC,CAACC,eAAF;AACD,GAFD;;AA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AA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAkBD,CAjED;;GAAMrB,yB;UAC4BF,W;;;KAD5BE,yB;AAmEN,eAAeA,yBAAf","sourcesContent":["import React, { useEffect, useState } from 'react'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./ConfirmRemoveAccountModal.css\"\r\nimport config from '../../config';\r\n\r\nconst ConfirmRemoveAccountModal = ({ removeModal, headerMessage, bodyMessage }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n\r\n const stopProp = e => {\r\n e.stopPropagation()\r\n }\r\n\r\n useEffect(() => {\r\n if (!authState.isAuthenticated) {\r\n // When user isn't authenticated, forget any user info\r\n setUserInfo(null);\r\n } else {\r\n oktaAuth.getUser().then(info => {\r\n setUserInfo(info);\r\n });\r\n }\r\n }, [authState, oktaAuth]); // Update if authState changes\r\n\r\n const removeAccountRequestOptions = {\r\n method: 'DELETE',\r\n body:\r\n userInfo && (\r\n JSON.stringify(\r\n {\r\n email: `${userInfo.email}`,\r\n }\r\n )\r\n )\r\n }\r\n\r\n const handleRemoveAccount = () => {\r\n console.log(userInfo)\r\n // fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions)\r\n // .then((res) => {\r\n // if (!res.ok) {\r\n // console.log(res)\r\n // window.alert(\"Error\")\r\n // Promise.reject(\"\")\r\n // return\r\n // }\r\n // if (res.ok) {\r\n // // oktaAuth.signOut()\r\n // }\r\n // })\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"confirmRemoveAccountModal\">\r\n <h2>Delete account</h2>\r\n <label>\r\n Are you sure you want to delete your account?\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n No\r\n </button>\r\n <button className=\"yesButton\" onClick={handleRemoveAccount}>\r\n Yes\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default ConfirmRemoveAccountModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\confirmRemoveAccountModal\\\\ConfirmRemoveAccountModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useEffect, useState } from 'react';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./ConfirmRemoveAccountModal.css\";\nimport config from '../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst ConfirmRemoveAccountModal = ({\n removeModal,\n headerMessage,\n bodyMessage\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n\n const stopProp = e => {\n e.stopPropagation();\n };\n\n useEffect(() => {\n if (!authState.isAuthenticated) {\n // When user isn't authenticated, forget any user info\n setUserInfo(null);\n } else {\n oktaAuth.getUser().then(info => {\n setUserInfo(info);\n });\n }\n }, [authState, oktaAuth]); // Update if authState changes\n\n const removeAccountRequestOptions = {\n method: 'DELETE',\n header: null,\n body: JSON.stringify({\n email: `${userInfo && userInfo.email}`\n })\n };\n\n const handleRemoveAccount = () => {\n console.log(removeAccountRequestOptions.body);\n fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions).then(res => {\n if (!res.ok) {\n console.log(res);\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n oktaAuth.signOut();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"confirmRemoveAccountModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Delete account\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 54,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"Are you sure you want to delete your account?\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 55,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"No\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 59,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n onClick: handleRemoveAccount,\n children: \"Yes\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 62,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 58,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 53,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 52,\n columnNumber: 5\n }, this);\n};\n\n_s(ConfirmRemoveAccountModal, \"/7FunoA1ejJNU8uKGTy1GZFqU2I=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = ConfirmRemoveAccountModal;\nexport default ConfirmRemoveAccountModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"ConfirmRemoveAccountModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/confirmRemoveAccountModal/ConfirmRemoveAccountModal.jsx"],"names":["React","useEffect","useState","useOktaAuth","config","ConfirmRemoveAccountModal","removeModal","headerMessage","bodyMessage","authState","oktaAuth","userInfo","setUserInfo","stopProp","e","stopPropagation","isAuthenticated","getUser","then","info","removeAccountRequestOptions","method","header","body","JSON","stringify","email","handleRemoveAccount","console","log","fetch","serviceAPI","removeAccountURL","res","ok","window","alert","Promise","reject","signOut"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,iCAAP;AACA,OAAOC,MAAP,MAAmB,cA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E,QAAAA,MAAM,CAACC,KAAP,CAAa,OAAb;AACAC,QAAAA,OAAO,CAACC,MAAR,CAAe,EAAf;AACA;AACD;;AACD,UAAIL,GAAG,CAACC,EAAR,EAAY;AACVxB,QAAAA,QAAQ,CAAC6B,OAAT;AACD;AACF,KAXH;AAYD,GAdD;;AAgBA,sBACE;AAAK,IAAA,SAAS,EAAC,eAAf;AAAA,2BACE;AAAK,MAAA,SAAS,EAAC,2BAAf;AAAA,8BACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cADF,eAEE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAFF,eAKE;AAAK,QAAA,SAAS,EAAC,iBAAf;AAAA,gCACE;AAAQ,UAAA,SAAS,EAAC,UAAlB;AAA6B,UAAA,OAAO,EAAEzB,CAAC,IAAIR,WAAW,EAAtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBADF,eAIE;AAAQ,UAAA,SAAS,EAAC,WAAlB;AAA8B,UAAA,OAAO,EAAEqB,mBAAvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAJF;AAAA;AAAA;AAAA;AAAA;AAAA,cALF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAkBD,CA/DD;;GAAMtB,yB;UAC4BF,W;;;KAD5BE,yB;AAiEN,eAAeA,yBAAf","sourcesContent":["import React, { useEffect, useState } from 'react'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./ConfirmRemoveAccountModal.css\"\r\nimport config from '../../config';\r\n\r\nconst ConfirmRemoveAccountModal = ({ removeModal, headerMessage, bodyMessage }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n\r\n const stopProp = e => {\r\n e.stopPropagation()\r\n }\r\n\r\n useEffect(() => {\r\n if (!authState.isAuthenticated) {\r\n // When user isn't authenticated, forget any user info\r\n setUserInfo(null);\r\n } else {\r\n oktaAuth.getUser().then(info => {\r\n setUserInfo(info);\r\n });\r\n }\r\n }, [authState, oktaAuth]); // Update if authState changes\r\n\r\n const removeAccountRequestOptions = {\r\n method: 'DELETE',\r\n header: null,\r\n body: JSON.stringify(\r\n {\r\n email: `${userInfo && userInfo.email}`,\r\n }\r\n )\r\n }\r\n\r\n const handleRemoveAccount = () => {\r\n console.log(removeAccountRequestOptions.body)\r\n fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n console.log(res)\r\n window.alert(\"Error\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n oktaAuth.signOut()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"confirmRemoveAccountModal\">\r\n <h2>Delete account</h2>\r\n <label>\r\n Are you sure you want to delete your account?\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n No\r\n </button>\r\n <button className=\"yesButton\" onClick={handleRemoveAccount}>\r\n Yes\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default ConfirmRemoveAccountModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\confirmRemoveAccountModal\\\\ConfirmRemoveAccountModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useEffect, useState } from 'react';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./ConfirmRemoveAccountModal.css\";\nimport config from '../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst ConfirmRemoveAccountModal = ({\n removeModal,\n headerMessage,\n bodyMessage\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n\n const stopProp = e => {\n e.stopPropagation();\n };\n\n useEffect(() => {\n if (!authState.isAuthenticated) {\n // When user isn't authenticated, forget any user info\n setUserInfo(null);\n } else {\n oktaAuth.getUser().then(info => {\n setUserInfo(info);\n });\n }\n }, [authState, oktaAuth]); // Update if authState changes\n\n const removeAccountRequestOptions = {\n method: 'DELETE',\n body: userInfo && JSON.stringify({\n email: `${userInfo.email}`\n })\n };\n\n const handleRemoveAccount = () => {\n fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions).then(res => {\n if (!res.ok) {\n console.log(res);\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n oktaAuth.signOut();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"confirmRemoveAccountModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Delete account\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 55,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"Are you sure you want to delete your account?\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 56,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"No\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 60,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n onClick: handleRemoveAccount,\n children: \"Yes\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 63,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 59,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 54,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 53,\n columnNumber: 5\n }, this);\n};\n\n_s(ConfirmRemoveAccountModal, \"/7FunoA1ejJNU8uKGTy1GZFqU2I=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = ConfirmRemoveAccountModal;\nexport default ConfirmRemoveAccountModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"ConfirmRemoveAccountModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/confirmRemoveAccountModal/ConfirmRemoveAccountModal.jsx"],"names":["React","useEffect","useState","useOktaAuth","config","ConfirmRemoveAccountModal","removeModal","headerMessage","bodyMessage","authState","oktaAuth","userInfo","setUserInfo","stopProp","e","stopPropagation","isAuthenticated","getUser","then","info","removeAccountRequestOptions","method","body","JSON","stringify","email","handleRemoveAccount","fetch","serviceAPI","removeAccountURL","res","ok","console","log","window","alert","Promise","reject","signOut"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,iCAAP;AACA,OAAOC,MAAP,MAAmB,cAAnB;;;AAEA,MAAMC,yBAAyB,GAAG,CAAC;AAAEC,EAAAA,WAAF;AAAeC,EAAAA,aAAf;AAA8BC,EAAAA;AAA9B,CAAD,KAAiD;AAAA;;AACjF,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BP,WAAW,EAA3C;AACA,QAAM,CAACQ,QAAD,EAAWC,WAAX,IAA0BV,QAAQ,CAAC,IAAD,CAAxC;;AAEA,QAAMW,QAAQ,GAAGC,CAAC,IAAI;AACpBA,IAAAA,CAAC,CAACC,eAAF;AACD,GAFD;;AAIAd,EAAAA,SAAS,CAAC,MAAM;AACd,QAAI,CAACQ,SAAS,CAACO,eAAf,EAAgC;AAC9B;AACAJ,MAAAA,WAAW,CAAC,IAAD,CAAX;AACD,KAHD,MAGO;AACLF,MAAAA,QAAQ,CAACO,OAAT,GAAmBC,IAAnB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A;AAAA;AAAA;AAAA;AAAA,gBAJF;AAAA;AAAA;AAAA;AAAA;AAAA,cALF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAkBD,CAhED;;GAAMrB,yB;UAC4BF,W;;;KAD5BE,yB;AAkEN,eAAeA,yBAAf","sourcesContent":["import React, { useEffect, useState } from 'react'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./ConfirmRemoveAccountModal.css\"\r\nimport config from '../../config';\r\n\r\nconst ConfirmRemoveAccountModal = ({ removeModal, headerMessage, bodyMessage }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n\r\n const stopProp = e => {\r\n e.stopPropagation()\r\n }\r\n\r\n useEffect(() => {\r\n if (!authState.isAuthenticated) {\r\n // When user isn't authenticated, forget any user info\r\n setUserInfo(null);\r\n } else {\r\n oktaAuth.getUser().then(info => {\r\n setUserInfo(info);\r\n });\r\n }\r\n }, [authState, oktaAuth]); // Update if authState changes\r\n\r\n const removeAccountRequestOptions = {\r\n method: 'DELETE',\r\n body:\r\n userInfo && (\r\n JSON.stringify(\r\n {\r\n email: `${userInfo.email}`,\r\n }\r\n )\r\n )\r\n }\r\n\r\n const handleRemoveAccount = () => {\r\n fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n console.log(res)\r\n window.alert(\"Error\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n oktaAuth.signOut()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"confirmRemoveAccountModal\">\r\n <h2>Delete account</h2>\r\n <label>\r\n Are you sure you want to delete your account?\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n No\r\n </button>\r\n <button className=\"yesButton\" onClick={handleRemoveAccount}>\r\n Yes\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default ConfirmRemoveAccountModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\confirmRemoveAccountModal\\\\ConfirmRemoveAccountModal.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useEffect, useState } from 'react';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./ConfirmRemoveAccountModal.css\";\nimport config from '../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst ConfirmRemoveAccountModal = ({\n removeModal,\n headerMessage,\n bodyMessage\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n\n const stopProp = e => {\n e.stopPropagation();\n };\n\n useEffect(() => {\n if (!authState.isAuthenticated) {\n // When user isn't authenticated, forget any user info\n setUserInfo(null);\n } else {\n oktaAuth.getUser().then(info => {\n setUserInfo(info);\n });\n }\n }, [authState, oktaAuth]); // Update if authState changes\n\n const removeAccountRequestOptions = {\n method: 'DELETE',\n body: JSON.stringify({\n email: `${userInfo && userInfo.email}`\n })\n };\n\n const handleRemoveAccount = () => {\n console.log(removeAccountRequestOptions.body);\n fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions).then(res => {\n if (!res.ok) {\n console.log(res);\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n oktaAuth.signOut();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"confirmRemoveAccountModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Delete account\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 53,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: \"Are you sure you want to delete your account?\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 54,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"No\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 58,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n onClick: handleRemoveAccount,\n children: \"Yes\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 61,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 57,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 52,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 51,\n columnNumber: 5\n }, this);\n};\n\n_s(ConfirmRemoveAccountModal, \"/7FunoA1ejJNU8uKGTy1GZFqU2I=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = ConfirmRemoveAccountModal;\nexport default ConfirmRemoveAccountModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"ConfirmRemoveAccountModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/confirmRemoveAccountModal/ConfirmRemoveAccountModal.jsx"],"names":["React","useEffect","useState","useOktaAuth","config","ConfirmRemoveAccountModal","removeModal","headerMessage","bodyMessage","authState","oktaAuth","userInfo","setUserInfo","stopProp","e","stopPropagation","isAuthenticated","getUser","then","info","removeAccountRequestOptions","method","body","JSON","stringify","email","handleRemoveAccount","console","log","fetch","serviceAPI","removeAccountURL","res","ok","window","alert","Promise","reject","signOut"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SAASC,WAAT,QAA4B,kBAA5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AAZ;AACAE,QAAAA,MAAM,CAACC,KAAP,CAAa,OAAb;AACAC,QAAAA,OAAO,CAACC,MAAR,CAAe,EAAf;AACA;AACD;;AACD,UAAIL,GAAG,CAACC,EAAR,EAAY;AACVvB,QAAAA,QAAQ,CAAC4B,OAAT;AACD;AACF,KAXH;AAYD,GAdD;;AAgBA,sBACE;AAAK,IAAA,SAAS,EAAC,eAAf;AAAA,2BACE;AAAK,MAAA,SAAS,EAAC,2BAAf;AAAA,8BACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cADF,eAEE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAFF,eAKE;AAAK,QAAA,SAAS,EAAC,iBAAf;AAAA,gCACE;AAAQ,UAAA,SAAS,EAAC,UAAlB;AAA6B,UAAA,OAAO,EAAExB,CAAC,IAAIR,WAAW,EAAtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBADF,eAIE;AAAQ,UAAA,SAAS,EAAC,WAAlB;AAA8B,UAAA,OAAO,EAAEoB,mBAAvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAJF;AAAA;AAAA;AAAA;AAAA;AAAA,cALF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAkBD,CA9DD;;GAAMrB,yB;UAC4BF,W;;;KAD5BE,yB;AAgEN,eAAeA,yBAAf","sourcesContent":["import React, { useEffect, useState } from 'react'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./ConfirmRemoveAccountModal.css\"\r\nimport config from '../../config';\r\n\r\nconst ConfirmRemoveAccountModal = ({ removeModal, headerMessage, bodyMessage }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n\r\n const stopProp = e => {\r\n e.stopPropagation()\r\n }\r\n\r\n useEffect(() => {\r\n if (!authState.isAuthenticated) {\r\n // When user isn't authenticated, forget any user info\r\n setUserInfo(null);\r\n } else {\r\n oktaAuth.getUser().then(info => {\r\n setUserInfo(info);\r\n });\r\n }\r\n }, [authState, oktaAuth]); // Update if authState changes\r\n\r\n const removeAccountRequestOptions = {\r\n method: 'DELETE',\r\n body: JSON.stringify(\r\n {\r\n email: `${userInfo && userInfo.email}`,\r\n }\r\n )\r\n }\r\n\r\n const handleRemoveAccount = () => {\r\n console.log(removeAccountRequestOptions.body)\r\n fetch(config.serviceAPI.removeAccountURL, removeAccountRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n console.log(res)\r\n window.alert(\"Error\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n oktaAuth.signOut()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"confirmRemoveAccountModal\">\r\n <h2>Delete account</h2>\r\n <label>\r\n Are you sure you want to delete your account?\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n No\r\n </button>\r\n <button className=\"yesButton\" onClick={handleRemoveAccount}>\r\n Yes\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default ConfirmRemoveAccountModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment