Commit 0ba88032 authored by Mathias Engelbrecht Pilegård's avatar Mathias Engelbrecht Pilegård
Browse files

added ability to remove users through post requests

parent b697b700
This diff is collapsed.
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\home\\\\Home.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect } from 'react';\nimport { NavLink } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Home.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport Updates from './updates/Updates';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Home = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\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 return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"page-content-container\",\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"content-header\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n className: \"welcome-text\",\n children: [\"Welcome \", userInfo ? userInfo.Id : \"...\", \"!\"]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 26,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(NavLink, {\n to: \"/reportissue\",\n children: /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"report-new-issue-button\",\n children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"exclamation-triangle\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 29,\n columnNumber: 13\n }, this), \"\\xA0\\xA0Report issues\"]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 28,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 27,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 25,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"homepage-content\",\n children: /*#__PURE__*/_jsxDEV(Updates, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 35,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 34,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 24,\n columnNumber: 5\n }, this);\n};\n\n_s(Home, \"/7FunoA1ejJNU8uKGTy1GZFqU2I=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Home;\nexport default Home;\n\nvar _c;\n\n$RefreshReg$(_c, \"Home\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/home/Home.jsx"],"names":["React","useState","useEffect","NavLink","useOktaAuth","FontAwesomeIcon","Updates","Home","authState","oktaAuth","userInfo","setUserInfo","isAuthenticated","getUser","then","info","Id"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,YAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAOC,OAAP,MAAoB,mBAApB;;;AAEA,MAAMC,IAAI,GAAG,MAAM;AAAA;;AACjB,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BL,WAAW,EAA3C;AACA,QAAM,CAACM,QAAD,EAAWC,WAAX,IAA0BV,QAAQ,CAAC,IAAD,CAAxC;AAEAC,EAAAA,SAAS,CAAC,MAAM;AACd,QAAI,CAACM,SAAS,CAACI,eAAf,EAAgC;AAC9B;AACAD,MAAAA,WAAW,CAAC,IAAD,CAAX;AACD,KAHD,MAGO;AACLF,MAAAA,QAAQ,CAACI,OAAT,GAAmBC,IAAnB,CAAwBC,IAAI,IAAI;AAC9BJ,QAAAA,WAAW,CAACI,IAAD,CAAX;AACD,OAFD;AAGD;AACF,GATQ,EASN,CAACP,SAAD,EAAYC,QAAZ,CATM,CAAT,CAJiB,CAaU;;AAE3B,sBACE;AAAK,IAAA,SAAS,EAAC,wBAAf;AAAA,4BACE;AAAK,MAAA,SAAS,EAAC,gBAAf;AAAA,8BACE;AAAI,QAAA,SAAS,EAAC,cAAd;AAAA,+BAAsCC,QAAQ,GAAGA,QAAQ,CAACM,EAAZ,GAAiB,KAA/D;AAAA;AAAA;AAAA;AAAA;AAAA,cADF,eAEE,QAAC,OAAD;AAAS,QAAA,EAAE,EAAC,cAAZ;AAAA,+BACE;AAAQ,UAAA,SAAS,EAAC,yBAAlB;AAAA,kCACE,QAAC,eAAD;AAAiB,YAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,kBADF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,cAFF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF,eAUE;AAAK,MAAA,SAAS,EAAC,kBAAf;AAAA,6BACE,QAAC,OAAD;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YAVF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAgBD,CA/BD;;GAAMT,I;UAC4BH,W;;;KAD5BG,I;AAiCN,eAAeA,IAAf","sourcesContent":["import React, { useState, useEffect } from 'react'\r\nimport { NavLink } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Home.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport Updates from './updates/Updates'\r\n\r\nconst Home = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\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 return (\r\n <div className=\"page-content-container\">\r\n <div className=\"content-header\">\r\n <h2 className=\"welcome-text\">Welcome {userInfo ? userInfo.Id : \"...\"}!</h2>\r\n <NavLink to=\"/reportissue\">\r\n <button className=\"report-new-issue-button\">\r\n <FontAwesomeIcon icon=\"exclamation-triangle\"></FontAwesomeIcon>\r\n &nbsp;&nbsp;Report issues\r\n </button>\r\n </NavLink>\r\n </div>\r\n <div className=\"homepage-content\">\r\n <Updates />\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default Home"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\home\\\\Home.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect } from 'react';\nimport { NavLink } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Home.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport Updates from './updates/Updates';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Home = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\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 return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"page-content-container\",\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"content-header\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n className: \"welcome-text\",\n children: [\"Welcome \", userInfo ? userInfo.password : \"...\", \"!\"]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 26,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(NavLink, {\n to: \"/reportissue\",\n children: /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"report-new-issue-button\",\n children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"exclamation-triangle\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 29,\n columnNumber: 13\n }, this), \"\\xA0\\xA0Report issues\"]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 28,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 27,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 25,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"homepage-content\",\n children: /*#__PURE__*/_jsxDEV(Updates, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 35,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 34,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 24,\n columnNumber: 5\n }, this);\n};\n\n_s(Home, \"/7FunoA1ejJNU8uKGTy1GZFqU2I=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Home;\nexport default Home;\n\nvar _c;\n\n$RefreshReg$(_c, \"Home\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/home/Home.jsx"],"names":["React","useState","useEffect","NavLink","useOktaAuth","FontAwesomeIcon","Updates","Home","authState","oktaAuth","userInfo","setUserInfo","isAuthenticated","getUser","then","info","password"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO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AAA;AAAA;AAAA,UADF;AAgBD,CA/BD;;GAAMT,I;UAC4BH,W;;;KAD5BG,I;AAiCN,eAAeA,IAAf","sourcesContent":["import React, { useState, useEffect } from 'react'\r\nimport { NavLink } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Home.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport Updates from './updates/Updates'\r\n\r\nconst Home = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\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 return (\r\n <div className=\"page-content-container\">\r\n <div className=\"content-header\">\r\n <h2 className=\"welcome-text\">Welcome {userInfo ? userInfo.password : \"...\"}!</h2>\r\n <NavLink to=\"/reportissue\">\r\n <button className=\"report-new-issue-button\">\r\n <FontAwesomeIcon icon=\"exclamation-triangle\"></FontAwesomeIcon>\r\n &nbsp;&nbsp;Report issues\r\n </button>\r\n </NavLink>\r\n </div>\r\n <div className=\"homepage-content\">\r\n <Updates />\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default Home"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\home\\\\Home.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect } from 'react';\nimport { NavLink } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Home.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport Updates from './updates/Updates';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Home = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\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 return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"page-content-container\",\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"content-header\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n className: \"welcome-text\",\n children: [\"Welcome \", userInfo ? userInfo.id : \"...\", \"!\"]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 26,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(NavLink, {\n to: \"/reportissue\",\n children: /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"report-new-issue-button\",\n children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"exclamation-triangle\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 29,\n columnNumber: 13\n }, this), \"\\xA0\\xA0Report issues\"]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 28,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 27,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 25,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"homepage-content\",\n children: /*#__PURE__*/_jsxDEV(Updates, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 35,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 34,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 24,\n columnNumber: 5\n }, this);\n};\n\n_s(Home, \"/7FunoA1ejJNU8uKGTy1GZFqU2I=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Home;\nexport default Home;\n\nvar _c;\n\n$RefreshReg$(_c, \"Home\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/home/Home.jsx"],"names":["React","useState","useEffect","NavLink","useOktaAuth","FontAwesomeIcon","Updates","Home","authState","oktaAuth","userInfo","setUserInfo","isAuthenticated","getUser","then","info","id"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,YAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAOC,OAAP,MAAoB,mBAApB;;;AAEA,MAAMC,IAAI,GAAG,MAAM;AAAA;;AACjB,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BL,WAAW,EAA3C;AACA,QAAM,CAACM,QAAD,EAAWC,WAAX,IAA0BV,QAAQ,CAAC,IAAD,CAAxC;AAEAC,EAAAA,SAAS,CAAC,MAAM;AACd,QAAI,CAACM,SAAS,CAACI,eAAf,EAAgC;AAC9B;AACAD,MAAAA,WAAW,CAAC,IAAD,CAAX;AACD,KAHD,MAGO;AACLF,MAAAA,QAAQ,CAACI,OAAT,GAAmBC,IAAnB,CAAwBC,IAAI,IAAI;AAC9BJ,QAAAA,WAAW,CAACI,IAAD,CAAX;AACD,OAFD;AAGD;AACF,GATQ,EASN,CAACP,SAAD,EAAYC,QAAZ,CATM,CAAT,CAJiB,CAaU;;AAE3B,sBACE;AAAK,IAAA,SAAS,EAAC,wBAAf;AAAA,4BACE;AAAK,MAAA,SAAS,EAAC,gBAAf;AAAA,8BACE;AAAI,QAAA,SAAS,EAAC,cAAd;AAAA,+BAAsCC,QAAQ,GAAGA,QAAQ,CAACM,EAAZ,GAAiB,KAA/D;AAAA;AAAA;AAAA;AAAA;AAAA,cADF,eAEE,QAAC,OAAD;AAAS,QAAA,EAAE,EAAC,cAAZ;AAAA,+BACE;AAAQ,UAAA,SAAS,EAAC,yBAAlB;AAAA,kCACE,QAAC,eAAD;AAAiB,YAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,kBADF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,cAFF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF,eAUE;AAAK,MAAA,SAAS,EAAC,kBAAf;AAAA,6BACE,QAAC,OAAD;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YAVF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAgBD,CA/BD;;GAAMT,I;UAC4BH,W;;;KAD5BG,I;AAiCN,eAAeA,IAAf","sourcesContent":["import React, { useState, useEffect } from 'react'\r\nimport { NavLink } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Home.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport Updates from './updates/Updates'\r\n\r\nconst Home = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\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 return (\r\n <div className=\"page-content-container\">\r\n <div className=\"content-header\">\r\n <h2 className=\"welcome-text\">Welcome {userInfo ? userInfo.id : \"...\"}!</h2>\r\n <NavLink to=\"/reportissue\">\r\n <button className=\"report-new-issue-button\">\r\n <FontAwesomeIcon icon=\"exclamation-triangle\"></FontAwesomeIcon>\r\n &nbsp;&nbsp;Report issues\r\n </button>\r\n </NavLink>\r\n </div>\r\n <div className=\"homepage-content\">\r\n <Updates />\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default Home"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\home\\\\Home.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect } from 'react';\nimport { NavLink } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Home.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport Updates from './updates/Updates';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Home = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\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 return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"page-content-container\",\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"content-header\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n className: \"welcome-text\",\n children: [\"Welcome \", userInfo ? userInfo.email : \"...\", \"!\"]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 26,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(NavLink, {\n to: \"/reportissue\",\n children: /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"report-new-issue-button\",\n children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"exclamation-triangle\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 29,\n columnNumber: 13\n }, this), \"\\xA0\\xA0Report issues\"]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 28,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 27,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 25,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"homepage-content\",\n children: /*#__PURE__*/_jsxDEV(Updates, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 35,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 34,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 24,\n columnNumber: 5\n }, this);\n};\n\n_s(Home, \"/7FunoA1ejJNU8uKGTy1GZFqU2I=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Home;\nexport default Home;\n\nvar _c;\n\n$RefreshReg$(_c, \"Home\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/home/Home.jsx"],"names":["React","useState","useEffect","NavLink","useOktaAuth","FontAwesomeIcon","Updates","Home","authState","oktaAuth","userInfo","setUserInfo","isAuthenticated","getUser","then","info","email"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,YAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAOC,OAAP,MAAoB,mBAApB;;;AAEA,MAAMC,IAAI,GAAG,MAAM;AAAA;;AACjB,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BL,WAAW,EAA3C;AACA,QAAM,CAACM,QAAD,EAAWC,WAAX,IAA0BV,QAAQ,CAAC,IAAD,CAAxC;AAEAC,EAAAA,SAAS,CAAC,MAAM;AACd,QAAI,CAACM,SAAS,CAACI,eAAf,EAAgC;AAC9B;AACAD,MAAAA,WAAW,CAAC,IAAD,CAAX;AACD,KAHD,MAGO;AACLF,MAAAA,QAAQ,CAACI,OAAT,GAAmBC,IAAnB,CAAwBC,IAAI,IAAI;AAC9BJ,QAAAA,WAAW,CAACI,IAAD,CAAX;AACD,OAFD;AAGD;AACF,GATQ,EASN,CAACP,SAAD,EAAYC,QAAZ,CATM,CAAT,CAJiB,CAaU;;AAE3B,sBACE;AAAK,IAAA,SAAS,EAAC,wBAAf;AAAA,4BACE;AAAK,MAAA,SAAS,EAAC,gBAAf;AAAA,8BACE;AAAI,QAAA,SAAS,EAAC,cAAd;AAAA,+BAAsCC,QAAQ,GAAGA,QAAQ,CAACM,KAAZ,GAAoB,KAAlE;AAAA;AAAA;AAAA;AAAA;AAAA,cADF,eAEE,QAAC,OAAD;AAAS,QAAA,EAAE,EAAC,cAAZ;AAAA,+BACE;AAAQ,UAAA,SAAS,EAAC,yBAAlB;AAAA,kCACE,QAAC,eAAD;AAAiB,YAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,kBADF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,cAFF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF,eAUE;AAAK,MAAA,SAAS,EAAC,kBAAf;AAAA,6BACE,QAAC,OAAD;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YAVF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAgBD,CA/BD;;GAAMT,I;UAC4BH,W;;;KAD5BG,I;AAiCN,eAAeA,IAAf","sourcesContent":["import React, { useState, useEffect } from 'react'\r\nimport { NavLink } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Home.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport Updates from './updates/Updates'\r\n\r\nconst Home = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\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 return (\r\n <div className=\"page-content-container\">\r\n <div className=\"content-header\">\r\n <h2 className=\"welcome-text\">Welcome {userInfo ? userInfo.email : \"...\"}!</h2>\r\n <NavLink to=\"/reportissue\">\r\n <button className=\"report-new-issue-button\">\r\n <FontAwesomeIcon icon=\"exclamation-triangle\"></FontAwesomeIcon>\r\n &nbsp;&nbsp;Report issues\r\n </button>\r\n </NavLink>\r\n </div>\r\n <div className=\"homepage-content\">\r\n <Updates />\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default Home"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\home\\\\Home.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect } from 'react';\nimport { NavLink } from 'react-router-dom';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Home.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport Updates from './updates/Updates';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Home = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\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 return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"page-content-container\",\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"content-header\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n className: \"welcome-text\",\n children: [\"Welcome \", userInfo ? userInfo.username : \"...\", \"!\"]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 26,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(NavLink, {\n to: \"/reportissue\",\n children: /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"report-new-issue-button\",\n children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"exclamation-triangle\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 29,\n columnNumber: 13\n }, this), \"\\xA0\\xA0Report issues\"]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 28,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 27,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 25,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"homepage-content\",\n children: /*#__PURE__*/_jsxDEV(Updates, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 35,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 34,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 24,\n columnNumber: 5\n }, this);\n};\n\n_s(Home, \"/7FunoA1ejJNU8uKGTy1GZFqU2I=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Home;\nexport default Home;\n\nvar _c;\n\n$RefreshReg$(_c, \"Home\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/home/Home.jsx"],"names":["React","useState","useEffect","NavLink","useOktaAuth","FontAwesomeIcon","Updates","Home","authState","oktaAuth","userInfo","setUserInfo","isAuthenticated","getUser","then","info","username"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,YAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAOC,OAAP,MA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KAD5BG,I;AAiCN,eAAeA,IAAf","sourcesContent":["import React, { useState, useEffect } from 'react'\r\nimport { NavLink } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Home.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport Updates from './updates/Updates'\r\n\r\nconst Home = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\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 return (\r\n <div className=\"page-content-container\">\r\n <div className=\"content-header\">\r\n <h2 className=\"welcome-text\">Welcome {userInfo ? userInfo.username : \"...\"}!</h2>\r\n <NavLink to=\"/reportissue\">\r\n <button className=\"report-new-issue-button\">\r\n <FontAwesomeIcon icon=\"exclamation-triangle\"></FontAwesomeIcon>\r\n &nbsp;&nbsp;Report issues\r\n </button>\r\n </NavLink>\r\n </div>\r\n <div className=\"homepage-content\">\r\n <Updates />\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default Home"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
......@@ -65,7 +65,7 @@ const SignUp = () => {
return
}
if (res.ok) {
handleSignInFormSubmit()
handleSignInFormSubmit(e)
}
})
}
......
......@@ -11,6 +11,7 @@ import (
"serviceAPI/service"
)
// TODO: Wrap "service.Authenticate()" around methods when done testing
func main() {
oktaUtils.ParseEnvironment()
router := mux.NewRouter()
......@@ -21,6 +22,7 @@ func main() {
// User Request Endpoints
router.HandleFunc("/api/get-users", service.GetUsers()).Methods("GET")
router.HandleFunc("/api/create-user", service.CreateUser()).Methods("POST")
router.HandleFunc("/api/remove-user", service.RemoveUser()).Methods("DELETE")
// Setup cors
......
......@@ -11,6 +11,7 @@ import (
)
type User struct {
Id string `json:"id"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Email string `json:"email"`
......@@ -23,7 +24,7 @@ type Users struct {
}
func printUser(user User) {
fmt.Println("Firstname:", user.FirstName, "Lastname:", user.LastName, "Email:", user.Email)
fmt.Print("\n Firstname:", user.FirstName, "\n Lastname:", user.LastName, "\n Email:", user.Email)
}
func printAllUsers(users []User) {
......@@ -53,6 +54,7 @@ func GetUsers() http.HandlerFunc {
for _, user := range users {
User := User{
Id: fmt.Sprintf("%v", (*user.Profile)["Id"]),
FirstName: fmt.Sprintf("%v", (*user.Profile)["firstName"]),
LastName: fmt.Sprintf("%v", (*user.Profile)["lastName"]),
Email: fmt.Sprintf("%v", (*user.Profile)["email"]),
......@@ -85,19 +87,19 @@ func CreateUser() http.HandlerFunc {
return
}
newUserData := User{}
tempUserData := User{}
if err := json.NewDecoder(r.Body).Decode(&newUserData);
if err := json.NewDecoder(r.Body).Decode(&tempUserData);
err != nil {
ReturnError(w, http.StatusInternalServerError, err.Error())
return
}
newUserData.Login = newUserData.Email
tempUserData.Login = tempUserData.Email
p := &okta.PasswordCredential{
Value: newUserData.Password,
Value: tempUserData.Password,
}
uc := &okta.UserCredentials{
......@@ -105,10 +107,10 @@ func CreateUser() http.HandlerFunc {
}
profile := okta.UserProfile{}
profile["firstName"] = newUserData.FirstName
profile["lastName"] = newUserData.LastName
profile["email"] = newUserData.Email
profile["login"] = newUserData.Login
profile["firstName"] = tempUserData.FirstName
profile["lastName"] = tempUserData.LastName
profile["email"] = tempUserData.Email
profile["login"] = tempUserData.Login
u := &okta.CreateUserRequest{
Credentials: uc,
......@@ -136,3 +138,53 @@ func CreateUser() http.HandlerFunc {
w.WriteHeader(http.StatusOK)
}
}
func RemoveUser() http.HandlerFunc {
return func(w http.ResponseWriter, r*http.Request) {
_, client, err := okta.NewClient(context.Background(), okta.WithOrgUrl("https://" + os.Getenv("CLIENT_ID")), okta.WithToken("007XkBhvAfeVf1jUB0xhdwQJJEvWNSBQ6bbO4MoEaV"))
if err != nil {
ReturnError(w, http.StatusInternalServerError, err.Error())
return
}
tempUserData := User{}
if err := json.NewDecoder(r.Body).Decode(&tempUserData);
err != nil {
ReturnError(w, http.StatusInternalServerError, err.Error())
return
}
fmt.Println("Removing User:", tempUserData.Email)
// User.Id == email
// Deactivate user first
resp, err := client.User.DeactivateUser(context.Background(), tempUserData.Email, &query.Params{})
if err != nil {
ReturnError(w, http.StatusInternalServerError, err.Error())
return
}
// Response.Message?
if _, err := w.Write([]byte(resp.Self)); err != nil {
ReturnError(w, http.StatusInternalServerError, err.Error())
return
}
// Now Remove user
response, err := client.User.DeactivateOrDeleteUser(context.Background(), "john-activate@example.com", &query.Params{})
if err != nil {
ReturnError(w, http.StatusInternalServerError, err.Error())
return
}
if _, err := w.Write([]byte(response.Self)); err != nil {
ReturnError(w, http.StatusInternalServerError, err.Error())
return
}
fmt.Println("User removal success")
}
}
\ 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