Commit 4ead96d5 authored by Mathias Engelbrecht Pilegård's avatar Mathias Engelbrecht Pilegård
Browse files

added new branch addTeam. Fixed user data update bug on cancel. Minor refactoring

parent 2c3853a1
[{"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\index.js":"1","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\config.js":"2","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\changePassword\\ChangePassword.js":"3","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\removeAccount\\RemoveAccount.js":"4","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\updateUserData\\UserDataInfo.js":"5","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\App.js":"6","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\reportForm\\ReportForm.js":"7","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\Messages\\Messages.js":"8","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\account\\Account.js":"9","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\home\\Home.js":"10","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\Login.js":"11","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\Navbar.js":"12","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectOverview\\ProjectOverview.js":"13","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\team\\teamOverview\\TeamOverview.js":"14","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\ProjectInfo.js":"15","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\team\\teamInfo\\TeamInfo.js":"16","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\util\\useMessages.js":"17","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\removeAccount\\confirmRemoveAccountModal\\ConfirmRemoveAccountModal.js":"18","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\reportForm\\assign\\Assign.js":"19","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\home\\updates\\Updates.js":"20","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\signUp\\SignUp.js":"21","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\passwordReset\\PasswordForgotModal.js":"22","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\navLinks\\NavLinks.js":"23","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\logo\\Logo.js":"24","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\searchbar\\Searchbar.js":"25","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\dropdownMenu\\NavbarDropdownMenu.js":"26","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\activityChart\\ActivityChart.js":"27","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\activitiesDisplay\\ActivitiesDisplay.js":"28","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\updateUserData\\updateUserDataModal\\UpdateUserDataModal.js":"29","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\messageModal\\MessageModal.js":"30"},{"size":285,"mtime":1628516023915,"results":"31","hashOfConfig":"32"},{"size":679,"mtime":1630597978614,"results":"33","hashOfConfig":"32"},{"size":4978,"mtime":1630604768651,"results":"34","hashOfConfig":"32"},{"size":1193,"mtime":1630598628940,"results":"35","hashOfConfig":"32"},{"size":2268,"mtime":1630602456219,"results":"36","hashOfConfig":"32"},{"size":2100,"mtime":1630597947062,"results":"37","hashOfConfig":"32"},{"size":3967,"mtime":1630590216333,"results":"38","hashOfConfig":"32"},{"size":626,"mtime":1630590171605,"results":"39","hashOfConfig":"32"},{"size":827,"mtime":1630600282620,"results":"40","hashOfConfig":"32"},{"size":1279,"mtime":1630590114274,"results":"41","hashOfConfig":"32"},{"size":2713,"mtime":1630590143680,"results":"42","hashOfConfig":"32"},{"size":906,"mtime":1630590064713,"results":"43","hashOfConfig":"32"},{"size":3660,"mtime":1630590207983,"results":"44","hashOfConfig":"32"},{"size":2694,"mtime":1630590244248,"results":"45","hashOfConfig":"32"},{"size":1068,"mtime":1630590183157,"results":"46","hashOfConfig":"32"},{"size":2374,"mtime":1630590235192,"results":"47","hashOfConfig":"32"},{"size":1489,"mtime":1630590258335,"results":"48","hashOfConfig":"32"},{"size":2003,"mtime":1630598660619,"results":"49","hashOfConfig":"32"},{"size":3264,"mtime":1630590221535,"results":"50","hashOfConfig":"32"},{"size":2334,"mtime":1630590120023,"results":"51","hashOfConfig":"32"},{"size":5569,"mtime":1630601630619,"results":"52","hashOfConfig":"32"},{"size":3623,"mtime":1630598820339,"results":"53","hashOfConfig":"32"},{"size":697,"mtime":1630590050913,"results":"54","hashOfConfig":"32"},{"size":548,"mtime":1630590043135,"results":"55","hashOfConfig":"32"},{"size":470,"mtime":1630590058062,"results":"56","hashOfConfig":"32"},{"size":3533,"mtime":1630590033678,"results":"57","hashOfConfig":"32"},{"size":3570,"mtime":1630590189058,"results":"58","hashOfConfig":"32"},{"size":2096,"mtime":1630590196227,"results":"59","hashOfConfig":"32"},{"size":3354,"mtime":1630602590152,"results":"60","hashOfConfig":"32"},{"size":517,"mtime":1630601765877,"results":"61","hashOfConfig":"32"},{"filePath":"62","messages":"63","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},"iyhzrm",{"filePath":"65","messages":"66","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"67","messages":"68","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"69","messages":"70","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"71","messages":"72","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"73","messages":"74","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"75","messages":"76","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"77","messages":"78","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"79","messages":"80","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"81","messages":"82","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"83","messages":"84","errorCount":0,"warningCount":6,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"85","messages":"86","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"87","messages":"88","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"89","messages":"90","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"91","messages":"92","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"93","messages":"94","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"95","messages":"96","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"97","messages":"98","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"99","messages":"100","errorCount":0,"warningCount":6,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"101","messages":"102","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"103","messages":"104","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"105","messages":"106","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"107","messages":"108","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"109","messages":"110","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"111","messages":"112","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"113","messages":"114","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"115","messages":"116","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"117","messages":"118","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"119","messages":"120","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"121","messages":"122","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\index.js",[],["123","124"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\config.js",["125"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\changePassword\\ChangePassword.js",["126"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\removeAccount\\RemoveAccount.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\updateUserData\\UserDataInfo.js",["127"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\App.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\reportForm\\ReportForm.js",["128"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\Messages\\Messages.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\account\\Account.js",["129","130","131"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\home\\Home.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\Login.js",["132","133","134","135","136","137"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\Navbar.js",["138"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectOverview\\ProjectOverview.js",["139","140"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\team\\teamOverview\\TeamOverview.js",["141","142"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\ProjectInfo.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\team\\teamInfo\\TeamInfo.js",["143"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\util\\useMessages.js",["144"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\removeAccount\\confirmRemoveAccountModal\\ConfirmRemoveAccountModal.js",["145"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\reportForm\\assign\\Assign.js",["146","147","148","149","150","151"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\home\\updates\\Updates.js",["152","153","154","155"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\signUp\\SignUp.js",["156","157","158","159"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\passwordReset\\PasswordForgotModal.js",["160","161"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\navLinks\\NavLinks.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\logo\\Logo.js",["162","163"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\searchbar\\Searchbar.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\dropdownMenu\\NavbarDropdownMenu.js",["164"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\activityChart\\ActivityChart.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\activitiesDisplay\\ActivitiesDisplay.js",["165","166","167","168"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\updateUserData\\updateUserDataModal\\UpdateUserDataModal.js",["169"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\messageModal\\MessageModal.js",["170"],{"ruleId":"171","replacedBy":"172"},{"ruleId":"173","replacedBy":"174"},{"ruleId":"175","severity":1,"message":"176","line":1,"column":1,"nodeType":"177","endLine":17,"endColumn":3},{"ruleId":"178","severity":1,"message":"179","line":66,"column":23,"nodeType":"180","messageId":"181","endLine":66,"endColumn":25},{"ruleId":"178","severity":1,"message":"179","line":20,"column":70,"nodeType":"180","messageId":"181","endLine":20,"endColumn":72},{"ruleId":"182","severity":1,"message":"183","line":1,"column":17,"nodeType":"184","messageId":"185","endLine":1,"endColumn":25},{"ruleId":"182","severity":1,"message":"183","line":2,"column":17,"nodeType":"184","messageId":"185","endLine":2,"endColumn":25},{"ruleId":"182","severity":1,"message":"186","line":2,"column":27,"nodeType":"184","messageId":"185","endLine":2,"endColumn":36},{"ruleId":"182","severity":1,"message":"187","line":5,"column":8,"nodeType":"184","messageId":"185","endLine":5,"endColumn":33},{"ruleId":"182","severity":1,"message":"186","line":1,"column":27,"nodeType":"184","messageId":"185","endLine":1,"endColumn":36},{"ruleId":"182","severity":1,"message":"188","line":1,"column":38,"nodeType":"184","messageId":"185","endLine":1,"endColumn":44},{"ruleId":"182","severity":1,"message":"189","line":6,"column":10,"nodeType":"184","messageId":"185","endLine":6,"endColumn":17},{"ruleId":"182","severity":1,"message":"190","line":7,"column":8,"nodeType":"184","messageId":"185","endLine":7,"endColumn":14},{"ruleId":"182","severity":1,"message":"191","line":8,"column":8,"nodeType":"184","messageId":"185","endLine":8,"endColumn":14},{"ruleId":"182","severity":1,"message":"192","line":32,"column":9,"nodeType":"184","messageId":"185","endLine":32,"endColumn":28},{"ruleId":"182","severity":1,"message":"193","line":10,"column":22,"nodeType":"184","messageId":"185","endLine":10,"endColumn":30},{"ruleId":"194","severity":1,"message":"195","line":75,"column":11,"nodeType":"196","endLine":75,"endColumn":123},{"ruleId":"194","severity":1,"message":"195","line":76,"column":11,"nodeType":"196","endLine":76,"endColumn":127},{"ruleId":"182","severity":1,"message":"197","line":8,"column":9,"nodeType":"184","messageId":"185","endLine":8,"endColumn":25},{"ruleId":"182","severity":1,"message":"198","line":13,"column":9,"nodeType":"184","messageId":"185","endLine":13,"endColumn":23},{"ruleId":"194","severity":1,"message":"195","line":43,"column":19,"nodeType":"196","endLine":43,"endColumn":22},{"ruleId":"199","severity":1,"message":"200","line":47,"column":6,"nodeType":"201","endLine":47,"endColumn":17,"suggestions":"202"},{"ruleId":"182","severity":1,"message":"203","line":11,"column":9,"nodeType":"184","messageId":"185","endLine":11,"endColumn":17},{"ruleId":"182","severity":1,"message":"183","line":1,"column":17,"nodeType":"184","messageId":"185","endLine":1,"endColumn":25},{"ruleId":"194","severity":1,"message":"195","line":29,"column":13,"nodeType":"196","endLine":29,"endColumn":16},{"ruleId":"194","severity":1,"message":"195","line":39,"column":19,"nodeType":"196","endLine":39,"endColumn":22},{"ruleId":"194","severity":1,"message":"195","line":50,"column":13,"nodeType":"196","endLine":50,"endColumn":16},{"ruleId":"194","severity":1,"message":"195","line":60,"column":19,"nodeType":"196","endLine":60,"endColumn":22},{"ruleId":"194","severity":1,"message":"195","line":70,"column":25,"nodeType":"196","endLine":70,"endColumn":28},{"ruleId":"194","severity":1,"message":"195","line":23,"column":17,"nodeType":"196","endLine":23,"endColumn":20},{"ruleId":"194","severity":1,"message":"195","line":28,"column":17,"nodeType":"196","endLine":28,"endColumn":20},{"ruleId":"194","severity":1,"message":"195","line":52,"column":19,"nodeType":"196","endLine":52,"endColumn":22},{"ruleId":"194","severity":1,"message":"195","line":57,"column":19,"nodeType":"196","endLine":57,"endColumn":22},{"ruleId":"182","severity":1,"message":"204","line":8,"column":11,"nodeType":"184","messageId":"185","endLine":8,"endColumn":20},{"ruleId":"182","severity":1,"message":"205","line":9,"column":10,"nodeType":"184","messageId":"185","endLine":9,"endColumn":22},{"ruleId":"199","severity":1,"message":"206","line":31,"column":6,"nodeType":"201","endLine":31,"endColumn":33,"suggestions":"207"},{"ruleId":"178","severity":1,"message":"179","line":84,"column":20,"nodeType":"180","messageId":"181","endLine":84,"endColumn":22},{"ruleId":"199","severity":1,"message":"208","line":38,"column":6,"nodeType":"201","endLine":38,"endColumn":41,"suggestions":"209"},{"ruleId":"194","severity":1,"message":"195","line":71,"column":11,"nodeType":"196","endLine":71,"endColumn":56},{"ruleId":"210","severity":1,"message":"211","line":12,"column":11,"nodeType":"196","endLine":12,"endColumn":58},{"ruleId":"210","severity":1,"message":"211","line":13,"column":11,"nodeType":"196","endLine":13,"endColumn":55},{"ruleId":"194","severity":1,"message":"195","line":88,"column":15,"nodeType":"196","endLine":88,"endColumn":35},{"ruleId":"194","severity":1,"message":"195","line":20,"column":17,"nodeType":"196","endLine":20,"endColumn":20},{"ruleId":"194","severity":1,"message":"195","line":25,"column":17,"nodeType":"196","endLine":25,"endColumn":20},{"ruleId":"194","severity":1,"message":"195","line":48,"column":17,"nodeType":"196","endLine":48,"endColumn":20},{"ruleId":"194","severity":1,"message":"195","line":53,"column":17,"nodeType":"196","endLine":53,"endColumn":20},{"ruleId":"182","severity":1,"message":"203","line":11,"column":9,"nodeType":"184","messageId":"185","endLine":11,"endColumn":17},{"ruleId":"182","severity":1,"message":"203","line":4,"column":9,"nodeType":"184","messageId":"185","endLine":4,"endColumn":17},"no-native-reassign",["212"],"no-negated-in-lhs",["213"],"import/no-anonymous-default-export","Assign object to a variable before exporting as module default","ExportDefaultDeclaration","eqeqeq","Expected '===' and instead saw '=='.","BinaryExpression","unexpected","no-unused-vars","'useState' is defined but never used.","Identifier","unusedVar","'useEffect' is defined but never used.","'ConfirmRemoveAccountModal' is defined but never used.","'useRef' is defined but never used.","'NavLink' is defined but never used.","'signUp' is defined but never used.","'config' is defined but never used.","'loginRequestOptions' is assigned a value but never used.","'oktaAuth' is assigned a value but never used.","jsx-a11y/anchor-is-valid","The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md","JSXOpeningElement","'personalProjects' is assigned a value but never used.","'sharedProjects' is assigned a value but never used.","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'oktaAuth'. Either include it or remove the dependency array.","ArrayExpression",["214"],"'stopProp' is assigned a value but never used.","'authState' is assigned a value but never used.","'sessionToken' is assigned a value but never used.","React Hook useEffect has a missing dependency: 'toggleSignUpFormVisible'. Either include it or remove the dependency array.",["215"],"React Hook useEffect has a missing dependency: 'toggleForgotPasswordFormVisible'. Either include it or remove the dependency array.",["216"],"jsx-a11y/alt-text","img elements must have an alt prop, either with meaningful text, or an empty string for decorative images.","no-global-assign","no-unsafe-negation",{"desc":"217","fix":"218"},{"desc":"219","fix":"220"},{"desc":"221","fix":"222"},"Update the dependencies array to be: [authState, oktaAuth]",{"range":"223","text":"224"},"Update the dependencies array to be: [signUpFormVisibilityState, toggleSignUpFormVisible]",{"range":"225","text":"226"},"Update the dependencies array to be: [forgotPasswordFormVisibilityState, toggleForgotPasswordFormVisible]",{"range":"227","text":"228"},[1422,1433],"[authState, oktaAuth]",[1028,1055],"[signUpFormVisibilityState, toggleSignUpFormVisible]",[1372,1407],"[forgotPasswordFormVisibilityState, toggleForgotPasswordFormVisible]"]
\ No newline at end of file
[{"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\index.js":"1","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\config.js":"2","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\changePassword\\ChangePassword.js":"3","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\removeAccount\\RemoveAccount.js":"4","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\updateUserData\\UserDataInfo.js":"5","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\App.js":"6","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\reportForm\\ReportForm.js":"7","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\Messages\\Messages.js":"8","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\account\\Account.js":"9","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\home\\Home.js":"10","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\Login.js":"11","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\Navbar.js":"12","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectOverview\\ProjectOverview.js":"13","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\team\\teamOverview\\TeamOverview.js":"14","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\ProjectInfo.js":"15","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\team\\teamInfo\\TeamInfo.js":"16","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\util\\useMessages.js":"17","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\removeAccount\\confirmRemoveAccountModal\\ConfirmRemoveAccountModal.js":"18","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\reportForm\\assign\\Assign.js":"19","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\home\\updates\\Updates.js":"20","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\signUp\\SignUp.js":"21","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\passwordReset\\PasswordForgotModal.js":"22","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\navLinks\\NavLinks.js":"23","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\logo\\Logo.js":"24","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\searchbar\\Searchbar.js":"25","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\dropdownMenu\\NavbarDropdownMenu.js":"26","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\activityChart\\ActivityChart.js":"27","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\activitiesDisplay\\ActivitiesDisplay.js":"28","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\updateUserData\\updateUserDataModal\\UpdateUserDataModal.js":"29","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\messageModal\\MessageModal.js":"30"},{"size":285,"mtime":1628516023915,"results":"31","hashOfConfig":"32"},{"size":679,"mtime":1630597978614,"results":"33","hashOfConfig":"32"},{"size":4979,"mtime":1630915073757,"results":"34","hashOfConfig":"32"},{"size":1193,"mtime":1630598628940,"results":"35","hashOfConfig":"32"},{"size":2268,"mtime":1630602456219,"results":"36","hashOfConfig":"32"},{"size":2100,"mtime":1630597947062,"results":"37","hashOfConfig":"32"},{"size":3967,"mtime":1630590216333,"results":"38","hashOfConfig":"32"},{"size":626,"mtime":1630590171605,"results":"39","hashOfConfig":"32"},{"size":827,"mtime":1630600282620,"results":"40","hashOfConfig":"32"},{"size":1279,"mtime":1630590114274,"results":"41","hashOfConfig":"32"},{"size":2713,"mtime":1630590143680,"results":"42","hashOfConfig":"32"},{"size":896,"mtime":1630915239644,"results":"43","hashOfConfig":"32"},{"size":3660,"mtime":1630590207983,"results":"44","hashOfConfig":"32"},{"size":2694,"mtime":1630590244248,"results":"45","hashOfConfig":"32"},{"size":1068,"mtime":1630590183157,"results":"46","hashOfConfig":"32"},{"size":2374,"mtime":1630590235192,"results":"47","hashOfConfig":"32"},{"size":1489,"mtime":1630590258335,"results":"48","hashOfConfig":"32"},{"size":2003,"mtime":1630598660619,"results":"49","hashOfConfig":"32"},{"size":3264,"mtime":1630590221535,"results":"50","hashOfConfig":"32"},{"size":2334,"mtime":1630590120023,"results":"51","hashOfConfig":"32"},{"size":5569,"mtime":1630601630619,"results":"52","hashOfConfig":"32"},{"size":3623,"mtime":1630598820339,"results":"53","hashOfConfig":"32"},{"size":697,"mtime":1630590050913,"results":"54","hashOfConfig":"32"},{"size":548,"mtime":1630590043135,"results":"55","hashOfConfig":"32"},{"size":470,"mtime":1630590058062,"results":"56","hashOfConfig":"32"},{"size":3533,"mtime":1630590033678,"results":"57","hashOfConfig":"32"},{"size":3570,"mtime":1630590189058,"results":"58","hashOfConfig":"32"},{"size":2096,"mtime":1630590196227,"results":"59","hashOfConfig":"32"},{"size":3280,"mtime":1630914970648,"results":"60","hashOfConfig":"32"},{"size":460,"mtime":1630915093745,"results":"61","hashOfConfig":"32"},{"filePath":"62","messages":"63","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},"iyhzrm",{"filePath":"65","messages":"66","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"67","usedDeprecatedRules":"64"},{"filePath":"68","messages":"69","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"70","messages":"71","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"72","messages":"73","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"74","usedDeprecatedRules":"64"},{"filePath":"75","messages":"76","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"77","messages":"78","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"79","usedDeprecatedRules":"64"},{"filePath":"80","messages":"81","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"82","messages":"83","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"84","usedDeprecatedRules":"64"},{"filePath":"85","messages":"86","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"87","messages":"88","errorCount":0,"warningCount":6,"fixableErrorCount":0,"fixableWarningCount":0,"source":"89","usedDeprecatedRules":"64"},{"filePath":"90","messages":"91","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"92","messages":"93","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"94","usedDeprecatedRules":"64"},{"filePath":"95","messages":"96","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"97","usedDeprecatedRules":"64"},{"filePath":"98","messages":"99","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"100","messages":"101","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"102","usedDeprecatedRules":"64"},{"filePath":"103","messages":"104","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"105","usedDeprecatedRules":"64"},{"filePath":"106","messages":"107","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"108","usedDeprecatedRules":"64"},{"filePath":"109","messages":"110","errorCount":0,"warningCount":6,"fixableErrorCount":0,"fixableWarningCount":0,"source":"111","usedDeprecatedRules":"64"},{"filePath":"112","messages":"113","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"114","usedDeprecatedRules":"64"},{"filePath":"115","messages":"116","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"117","usedDeprecatedRules":"64"},{"filePath":"118","messages":"119","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"120","usedDeprecatedRules":"64"},{"filePath":"121","messages":"122","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"123","messages":"124","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"125","usedDeprecatedRules":"64"},{"filePath":"126","messages":"127","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"128","messages":"129","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"130","usedDeprecatedRules":"64"},{"filePath":"131","messages":"132","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"64"},{"filePath":"133","messages":"134","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"135","usedDeprecatedRules":"64"},{"filePath":"136","messages":"137","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"138","messages":"139","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\index.js",[],["140","141"],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\config.js",["142"],"export default {\r\n oidc: {\r\n clientId: '0oa1f4zfeiiZPB6DF5d7',\r\n issuer: 'https://dev-91882654.okta.com/oauth2/default',\r\n redirectUri: window.location.origin + '/login/callback',\r\n scopes: ['openid', 'profile', 'email'],\r\n pkce: true\r\n },\r\n serviceAPI: {\r\n messagesURL: 'http://localhost:3030/api/messages',\r\n createNewUserURL: 'http://localhost:3030/api/create-user',\r\n forgotPasswordURL: 'http://localhost:3030/api/recover-user-password',\r\n removeAccountURL: 'http://localhost:3030/api/remove-user',\r\n updateUserDataURL: 'http://localhost:3030/api/update-user-data',\r\n changePasswordURL: 'http://localhost:3030/api/change-password'\r\n }\r\n};","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\changePassword\\ChangePassword.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\removeAccount\\RemoveAccount.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\updateUserData\\UserDataInfo.js",["143"],"import React, { useEffect, useState } from 'react'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport UpdateUserDataModal from '../../components/updateUserData/updateUserDataModal/UpdateUserDataModal';\r\n\r\nconst UpdateUserData = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n\r\n const [name, setName] = useState('')\r\n const [email, setEmail] = useState('');\r\n\r\n const [updateUserDataModalState, setUpdateUserDataModalState] = useState(false)\r\n const toggleUpdateUserDataModalState = () => setUpdateUserDataModalState(!updateUserDataModalState)\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 if (authState.isAuthenticated && updateUserDataModalState == false) {\r\n oktaAuth.getUser().then(info => {\r\n setUserInfo(info);\r\n });\r\n }\r\n }, [authState, oktaAuth, updateUserDataModalState]); // Update if authState changes\r\n\r\n useEffect(() => {\r\n userInfo && (\r\n setName(userInfo.name)\r\n )\r\n\r\n userInfo && (\r\n setEmail(userInfo.email)\r\n )\r\n }, [userInfo])\r\n\r\n return (\r\n <div className=\"personal-information-container\">\r\n <div className=\"container-header\">\r\n <FontAwesomeIcon icon=\"user-circle\" className=\"user-icon\"></FontAwesomeIcon>\r\n <h5>Personal information</h5>\r\n <button onClick={toggleUpdateUserDataModalState}>\r\n <FontAwesomeIcon icon=\"pen\" className=\"pen-icon\"></FontAwesomeIcon>\r\n Edit\r\n </button>\r\n </div>\r\n <div className=\"content\">\r\n <ul>\r\n <li>\r\n <b>Name:</b>\r\n </li>\r\n <li>\r\n {userInfo ? name : \"Fetching name\"}\r\n </li>\r\n <li>\r\n <b>Email</b>\r\n </li>\r\n <li>\r\n {userInfo ? email : \"Fetching email\"}\r\n </li>\r\n </ul>\r\n </div>\r\n <div className={`modal ${updateUserDataModalState ? \"active\" : \"inactive\"}`}>\r\n <UpdateUserDataModal removeModal={() => setUpdateUserDataModalState(false)} />\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default UpdateUserData\r\n","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\App.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\reportForm\\ReportForm.js",["144"],"import React, { useState } from 'react'\r\nimport \"./ReportForm.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport Assign from './assign/Assign'\r\n\r\nconst ReportForm = () => {\r\n return (\r\n <div className=\"page-content-container\">\r\n <h2 className=\"reportissuePageText\">Report an issue</h2>\r\n <form action=\"/reportFormData\">\r\n <div className=\"row\">\r\n <div className=\"col-25\">\r\n <label for=\"fissueType\">Type of issue</label>\r\n </div>\r\n <div className=\"col-75\">\r\n <select id=\"fissueType\" className=\"issueType\">\r\n <option value=\"bug\">Bug</option>\r\n <option value=\"usabilityissue\">Usability error</option>\r\n <option value=\"other\">Other</option>\r\n </select>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row\">\r\n <div class=\"col-25\">\r\n <label for=\"fissueLocation\">Where did you encounter the issue?</label>\r\n </div>\r\n <div class=\"col-75\">\r\n <input type=\"text\" id=\"fissueLocation\" className=\"issueLocation\" ></input>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row\">\r\n <div class=\"col-25\">\r\n <label for=\"fissueDescription\">Describe the issue</label>\r\n </div>\r\n <div class=\"col-75\">\r\n <textarea id=\"fissueDescription\" className=\"issueDescription\"></textarea>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row\">\r\n <div class=\"col-25\">\r\n <label for=\"fissueStepsToTeproduce\">What steps did you take before the issue happened?</label>\r\n </div>\r\n <div class=\"col-75\">\r\n <textarea id=\"fissueStepsToTeproduce\" className=\"issueStepsToReproduce\"\r\n placeholder=\"List the steps that occurred before the issue happened:\r\n1.\r\n2.\r\n3.\r\nExpected Result:\r\nActual Result:\">\r\n </textarea>\r\n </div>\r\n </div>\r\n\r\n <div className=\"row\">\r\n <div className=\"col-25\">\r\n <label for=\"fissueSeverity\">Severity level</label>\r\n </div>\r\n <div className=\"col-75\">\r\n <select id=\"fissueSeverity\" className=\"issueSeverity\">\r\n <option value=\"cosmetic\">Cosmetic - should be corrected when time permits</option>\r\n <option value=\"serious\">Serious - should be corrected in the next release</option>\r\n <option value=\"critical\">Critical - should be corrected as soon as possible</option>\r\n </select>\r\n </div>\r\n </div>\r\n\r\n <div className=\"row\">\r\n <div className=\"col-25\">\r\n <label for=\"fissueTimeToCorrect\">Time to Correct</label>\r\n </div>\r\n <div className=\"col-75\">\r\n <select id=\"fissueSeverity\" className=\"issueTimeToCorrect\">\r\n <option value=\"lessThanTwoHours\">Less than 2 minutes</option>\r\n <option value=\"lessThanOneToTwoDays\">Less than 1 or 2 days</option>\r\n <option value=\"lessThanOneToTwoWeeks\">Less than 1 or 2 weeks</option>\r\n <option value=\"atLeastTwoWeeks\">More than 2 weeks</option>\r\n </select>\r\n </div>\r\n </div>\r\n\r\n <div className=\"row\">\r\n <div className=\"col-25\">\r\n <label for=\"fissueAssignToProject\">Assign to</label>\r\n </div>\r\n <div className=\"col-75\">\r\n {/*\r\n <select id=\"fissueAssignToProject\" className=\"issueAssignToProject\">\r\n <option value=\"lessThanTwoHours\">Henriks meme machine - ReactApp</option>\r\n </select>\r\n */}\r\n <Assign />\r\n </div>\r\n </div>\r\n\r\n\r\n <div class=\"row\">\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Submit&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </div>\r\n </form>\r\n </div >\r\n )\r\n}\r\n\r\nexport default ReportForm","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\Messages\\Messages.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\account\\Account.js",["145","146","147"],"// rfce\r\nimport React, { useState, useEffect } from 'react'\r\nimport \"./Account.css\"\r\n\r\nimport ConfirmRemoveAccountModal from \"../../components/removeAccount/confirmRemoveAccountModal/ConfirmRemoveAccountModal\"\r\nimport ChangePassword from '../../components/changePassword/ChangePassword';\r\nimport RemoveAccount from '../../components/removeAccount/RemoveAccount';\r\nimport UserDataInfo from '../../components/updateUserData/UserDataInfo';\r\n\r\nfunction Account() {\r\n return (\r\n <div className=\"page-content-container\">\r\n <div className=\"content-header\">\r\n <h2 className=\"welcome-text\">Account information</h2>\r\n </div>\r\n <div className=\"accountpage-content\">\r\n\r\n <UserDataInfo />\r\n <ChangePassword />\r\n <RemoveAccount />\r\n\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default Account\r\n","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\home\\Home.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\Login.js",["148","149","150","151","152","153"],"import React, { useState, useEffect, useRef } from 'react';\r\nimport { Redirect } from 'react-router-dom'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Login.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport { NavLink } from 'react-router-dom';\r\nimport signUp from './signUp/SignUp';\r\nimport config from '../../config';\r\nimport SignUp from './signUp/SignUp';\r\nimport PasswordForgotModal from './passwordReset/PasswordForgotModal';\r\n\r\nconst Login = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [sessionToken, setSessionToken] = useState()\r\n\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const handlePasswordChange = (e) => {\r\n setPassword(e.target.value)\r\n }\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n const loginRequestOptions = {\r\n method: 'POST',\r\n body: userInputData\r\n };\r\n\r\n const handleSignInFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n oktaAuth.signInWithCredentials({ username, password })\r\n .then(res => {\r\n const sessionToken = res.sessionToken;\r\n setSessionToken(sessionToken);\r\n // sessionToken is a one-use token, so make sure this is only called once\r\n oktaAuth.signInWithRedirect({ sessionToken, originalUri: '/home' });\r\n })\r\n .catch(err => console.log('Found an error', err));\r\n };\r\n\r\n if (sessionToken) {\r\n // Hide form while sessionToken is converted into id/access tokens\r\n return null;\r\n }\r\n\r\n if (!authState || !authState.isAuthenticated) {\r\n return (\r\n <div className=\"pageContainer\">\r\n <SignUp />\r\n\r\n <div className=\"signInForm\">\r\n <h2>Sign in to PipIt</h2>\r\n <form onSubmit={handleSignInFormSubmit}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"username\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign in&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"sign-in-alt\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n <PasswordForgotModal />\r\n </div>\r\n </div>\r\n )\r\n } else {\r\n return <Redirect to=\"/home\" />\r\n }\r\n}\r\n\r\nexport default Login","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\Navbar.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectOverview\\ProjectOverview.js",["154","155"],"import React, { useState } from 'react'\r\nimport { NavLink } from \"react-router-dom\";\r\nimport \"./ProjectOverview.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\n\r\nconst ProjectOverview = () => {\r\n const personalProjects = [\r\n { id: \"MyApp\", type: \"personal\" },\r\n { id: \"MyOtherApp\", type: \"personal\" }\r\n ]\r\n\r\n const sharedProjects = [\r\n { id: \"ReactApp\", type: \"shared\", teams: [{ name: \"Henriks Meme Machine\" }, { name: \"Teskeholdet\" }] },\r\n { id: \"Very big ReactApp\", type: \"shared\", teams: [{ name: \"Aubergine\" }] }\r\n ]\r\n\r\n const [sharedProjectsButtonState, setSharedProjectsButtonState] = useState(true);\r\n const [personalProjectsButtonState, setPersonalProjectsButtonState] = useState(false);\r\n\r\n const SharedProjectsButtonActive = () => {\r\n setSharedProjectsButtonState(true);\r\n setPersonalProjectsButtonState(false);\r\n };\r\n\r\n const PersonalProjectsButtonActive = () => {\r\n setSharedProjectsButtonState(false);\r\n setPersonalProjectsButtonState(true);\r\n };\r\n\r\n const ProjectsDisplay = (projects) => {\r\n return (\r\n <div className=\"projectlist\">\r\n <ul>\r\n {projects.map((elements, index) => (\r\n <li>\r\n <div className=\"project-entry\">\r\n <div className=\"project-team-name\">\r\n <NavLink to={`/${projects[index].id}`}>{projects[index].id}&nbsp;\r\n <FontAwesomeIcon className=\"icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </NavLink>\r\n </div>\r\n <div className=\"project-status-info-container\">\r\n <div className=\"new-issues-info\">\r\n <FontAwesomeIcon className=\"icon\" icon=\"bug\"></FontAwesomeIcon>\r\n <p>0</p>\r\n <span className=\"tooltip-text\">Total issues</span>\r\n </div>\r\n <div className=\"issues-solved-info\">\r\n <FontAwesomeIcon className=\"icon\" icon=\"check\"></FontAwesomeIcon>\r\n <p>0</p>\r\n <span className=\"tooltip-text\">Issues solved</span>\r\n </div>\r\n <div className=\"last-updated-info\">\r\n <p>Last updated: &nbsp;1 day ago</p>\r\n </div>\r\n </div>\r\n </div>\r\n </li>\r\n ))}\r\n </ul>\r\n </div>\r\n )\r\n }\r\n\r\n return (\r\n <div className=\"page-content-container\">\r\n <div className=\"content-header\">\r\n <h2 className=\"projectlist-title\">Your Projects</h2>\r\n <button className=\"create-new-project-button\">\r\n New Project\r\n </button>\r\n </div>\r\n <div className=\"project-sort-menu-container\">\r\n <div className=\"personal-shared-projects-container\">\r\n <a className={sharedProjectsButtonState ? \"activeUnderlined\" : \"inactive\"} onClick={SharedProjectsButtonActive}>Shared Projects</a>\r\n <a className={personalProjectsButtonState ? \"activeUnderlined\" : \"inactive\"} onClick={PersonalProjectsButtonActive}>Personal Projects</a>\r\n </div>\r\n <div className=\"project-sort-select-container\">\r\n <p>Sort by:</p>\r\n <select>\r\n <option>Last updated</option>\r\n <option>Last created</option>\r\n <option>Name</option>\r\n <option>Name descending</option>\r\n <option>Oldest created</option>\r\n <option>Oldest updated</option>\r\n </select>\r\n </div>\r\n </div>\r\n {sharedProjectsButtonState ? ProjectsDisplay(sharedProjects) : ProjectsDisplay(personalProjects)}\r\n </div >\r\n )\r\n}\r\n\r\nexport default ProjectOverview","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\team\\teamOverview\\TeamOverview.js",["156","157"],"import React from 'react'\r\nimport { NavLink } from 'react-router-dom'\r\nimport \"./TeamOverview.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\n\r\nconst TeamOverview = () => {\r\n\r\n const personalProjects = [\r\n { id: \"MyApp\", type: \"personal\" },\r\n { id: \"MyOtherApp\", type: \"personal\" }\r\n ]\r\n\r\n const sharedProjects = [\r\n { id: \"ReactApp\", type: \"shared\", teams: [{ name: \"Henriks Meme Machine\" }, { name: \"Teskeholdet\" }] },\r\n { id: \"Very big ReactApp\", type: \"shared\", teams: [{ name: \"Aubergine\" }] }\r\n ]\r\n\r\n return (\r\n <div className=\"page-content-container\">\r\n <div className=\"content-header\">\r\n <h2 className=\"teamlist-title\">Teams</h2>\r\n <div className=\"buttons-container\">\r\n <button className=\"join-team-button\">\r\n Join Team\r\n </button>\r\n <button className=\"create-new-team-button\">\r\n New team\r\n </button>\r\n </div>\r\n </div>\r\n <div className=\"teamlist\">\r\n <ul>\r\n <li>\r\n <div className=\"team-entry\">\r\n <div className=\"image-team-name\">\r\n <NavLink to=\"/HenriksMemeMachine\" className=\"team-image-container\">\r\n <FontAwesomeIcon className=\"team-icon\" icon=\"dice-d6\"></FontAwesomeIcon>\r\n </NavLink>\r\n <NavLink to=\"/HenriksMemeMachine\">Henriks meme machine - ReactApp&nbsp;\r\n <FontAwesomeIcon className=\"icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </NavLink>\r\n </div>\r\n <div className=\"team-status-info-container\">\r\n <div className=\"new-messages-info\">\r\n <FontAwesomeIcon className=\"icon\" icon=\"envelope\"></FontAwesomeIcon>\r\n <p>0</p>\r\n <span className=\"tooltip-text\">New messages</span>\r\n </div>\r\n <div className=\"projects-maintained-info\">\r\n <FontAwesomeIcon className=\"icon\" icon=\"project-diagram\"></FontAwesomeIcon>\r\n <p>0</p>\r\n <span className=\"tooltip-text\">Projects maintained</span>\r\n </div>\r\n <div className=\"team-members-info\">\r\n <FontAwesomeIcon className=\"icon\" icon=\"users\"></FontAwesomeIcon>\r\n <p>0</p>\r\n <span className=\"tooltip-text\">Team members</span>\r\n </div>\r\n <div className=\"last-updated-info\">\r\n <p>Date created: &nbsp;21/ 07/ 2021</p>\r\n </div>\r\n </div>\r\n </div>\r\n </li>\r\n </ul>\r\n </div>\r\n </div >\r\n )\r\n}\r\n\r\nexport default TeamOverview","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\ProjectInfo.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\team\\teamInfo\\TeamInfo.js",["158"],"import React, { useRef, useState, useEffect } from 'react'\r\nimport \"./TeamInfo.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\r\n\r\nconst TeamInfo = () => {\r\n const dropdownRef = useRef(null);\r\n const [isActive, setIsActive] = useState(false);\r\n const onClick = () => setIsActive(!isActive);\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (dropdownRef.current !== null && !dropdownRef.current.contains(e.target)) {\r\n setIsActive(!isActive);\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (isActive) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [isActive]);\r\n\r\n return (\r\n <div className=\"page-content-container\">\r\n <div className=\"teamInformationPage-content-header\">\r\n <div className=\"header-text\">\r\n <h2 className=\"teamInformationPage-title\">Henriks Meme machine > overview</h2>\r\n </div>\r\n <div className=\"header-notification-select-settings-button-container\">\r\n <div className=\"notification-button-container\">\r\n <button className={`notification-button ${isActive ? 'active' : 'inactive'}`} onClick={onClick} >\r\n <FontAwesomeIcon className=\"bell-icon\" icon=\"bell\"></FontAwesomeIcon>\r\n <FontAwesomeIcon className=\"down-arrow\" icon=\"angle-down\"></FontAwesomeIcon>\r\n </button>\r\n <div ref={dropdownRef} className={`user-dropDown-menu-content ${isActive ? 'active' : 'inactive'}`}>\r\n <ul>\r\n <li>\r\n <a>\r\n <FontAwesomeIcon icon=\"user\"></FontAwesomeIcon>&nbsp;&nbsp;Account\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </a>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n <div className=\"settings-button-container\">\r\n <button>\r\n <FontAwesomeIcon icon=\"cog\"></FontAwesomeIcon>\r\n &nbsp;Settings\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n <div className=\"teamInformationPage-content-container\">\r\n {/*TODO: components goes here */}\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default TeamInfo","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\util\\useMessages.js",["159"],"import { useState, useEffect } from 'react';\r\nimport { useOktaAuth } from '@okta/okta-react';\r\n\r\nimport config from \"../config\"\r\n\r\nconst useMessages = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [messages, setMessages] = useState(null);\r\n\r\n // fetch messages\r\n useEffect(() => {\r\n if (authState && authState.isAuthenticated) {\r\n const accessToken = oktaAuth.getAccessToken();\r\n fetch(config.serviceAPI.messagesURL, {\r\n method: 'GET',\r\n headers: {\r\n Authorization: `Bearer ${accessToken}`,\r\n },\r\n })\r\n .then((response) => {\r\n if (!response.ok) {\r\n return Promise.reject();\r\n }\r\n return response.json();\r\n })\r\n .then((data) => {\r\n let index = 0;\r\n const formattedMessages = data.messages.map((message) => {\r\n const date = new Date(message.date);\r\n const day = date.toLocaleDateString();\r\n const time = date.toLocaleTimeString();\r\n index += 1;\r\n return {\r\n date: `${day} ${time}`,\r\n sender: message.sender,\r\n text: message.text,\r\n id: `message-${index}`,\r\n };\r\n });\r\n setMessages(formattedMessages);\r\n })\r\n .catch((err) => {\r\n /* eslint-disable no-console */\r\n console.error(err);\r\n });\r\n }\r\n }, [authState]);\r\n\r\n return messages\r\n}\r\n\r\nexport default useMessages","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\removeAccount\\confirmRemoveAccountModal\\ConfirmRemoveAccountModal.js",["160"],"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 }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n const accessToken = oktaAuth.getAccessToken();\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 headers: {\r\n Authorization: `Bearer ${accessToken}`,\r\n },\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","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\reportForm\\assign\\Assign.js",["161","162","163","164","165","166"],"import React, { useState } from 'react'\r\nimport \"./Assign.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\n\r\nconst Assign = () => {\r\n const personalProjects = [\r\n { id: \"MyApp\", type: \"personal\" },\r\n { id: \"MyOtherApp\", type: \"personal\" }\r\n ]\r\n\r\n const sharedProjects = [\r\n { id: \"ReactApp\", type: \"shared\", teams: [{ name: \"Henriks Meme Machine\" }, { name: \"Teskeholdet\" }] },\r\n { id: \"Very big ReactApp\", type: \"shared\", teams: [{ name: \"Aubergine\" }] }\r\n ]\r\n\r\n\r\n const rootDirectoryObjects = [\r\n { id: \"Personal projects\" },\r\n { id: \"Shared projects\" }\r\n ]\r\n\r\n const DirectoryItems = () => {\r\n return (\r\n <div className=\"multi-level\">\r\n <div className=\"item\">\r\n <input type=\"checkbox\" id=\"A\" />\r\n <label for=\"A\">\r\n <FontAwesomeIcon icon=\"folder\" className=\"folder-icon\"></FontAwesomeIcon>\r\n <a>&nbsp; {rootDirectoryObjects[0].id} &nbsp;</a>\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </label>\r\n\r\n <ul>\r\n {personalProjects.map((elements, index) => (\r\n <li className=\"personalProjectsItem\">\r\n <input type=\"checkbox\" id={`A-${index}`} />\r\n <label for={`A-${index}`}>\r\n <FontAwesomeIcon icon=\"angle-right\" className=\"project-icon\"></FontAwesomeIcon>\r\n <a>&nbsp; {personalProjects[index].id} &nbsp;</a>\r\n </label>\r\n </li>\r\n ))}\r\n </ul>\r\n </div>\r\n\r\n <div className=\"item\">\r\n <input type=\"checkbox\" id=\"B\" />\r\n <label for=\"B\">\r\n <FontAwesomeIcon icon=\"folder\" className=\"folder-icon\"></FontAwesomeIcon>\r\n <a>&nbsp; {rootDirectoryObjects[1].id} &nbsp;</a>\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </label>\r\n\r\n <ul>\r\n {sharedProjects.map((elements, index) => (\r\n <li><div className=\"sub-item\">\r\n <input type=\"checkbox\" id={`B-${index}`} />\r\n <label for={`B-${index}`}>\r\n <FontAwesomeIcon icon=\"folder\" className=\"folder-icon\"></FontAwesomeIcon>\r\n <a>&nbsp; {sharedProjects[index].id} &nbsp;</a>\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </label>\r\n\r\n <ul>\r\n {sharedProjects[index].teams.map(team => (\r\n <li><div className=\"team-item\">\r\n <input type=\"checkbox\" id={`team-${team.name}`} />\r\n <label for={`team-${team.name}`}>\r\n <FontAwesomeIcon icon=\"users\" className=\"users-icon\"></FontAwesomeIcon>\r\n <a>&nbsp; {team.name} &nbsp;</a>\r\n </label>\r\n </div>\r\n </li>\r\n ))}\r\n </ul>\r\n </div>\r\n </li>\r\n ))}\r\n </ul>\r\n </div>\r\n </div>\r\n\r\n )\r\n }\r\n\r\n return (\r\n <div className=\"assignSelectContainer\">\r\n <DirectoryItems />\r\n </div >\r\n )\r\n}\r\n\r\nexport default Assign","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\home\\updates\\Updates.js",["167","168","169","170"],"import React from 'react'\r\nimport \"./Updates.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport useMessages from '../../../util/useMessages'\r\n\r\nconst Updates = () => {\r\n const messages = useMessages()\r\n\r\n return (\r\n <div className=\"project-updates-new-messages-container\">\r\n\r\n <div className=\"project-updates-display-container\">\r\n <div className=\"project-updates-display-header\">\r\n <p>\r\n <FontAwesomeIcon icon=\"exclamation\"></FontAwesomeIcon>\r\n &nbsp;&nbsp;New project updates\r\n </p>\r\n </div>\r\n <div className=\"project-updates-display-content\">\r\n <div className=\"project-update-entry\">\r\n <div className=\"entry-text\">\r\n <div className=\"upper-row\">\r\n <a>\r\n [project] [new issues] [issues fixed]\r\n </a>\r\n </div>\r\n <div className=\"bottom-row\">\r\n <a>\r\n [team] [time]\r\n </a>\r\n </div>\r\n </div>\r\n <div>\r\n <FontAwesomeIcon className=\"entry-icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div className=\"new-messages-display-container\">\r\n <div className=\"new-messages-display-header\">\r\n <p>\r\n <FontAwesomeIcon icon=\"envelope\"></FontAwesomeIcon>\r\n &nbsp;&nbsp;New messages\r\n </p>\r\n </div>\r\n {messages ? messages.map((message) => (\r\n <div className=\"new-messages-display-content\">\r\n <div className=\"new-message-entry\">\r\n <div className=\"entry-text\">\r\n <div className=\"upper-row\">\r\n <a>\r\n [{message.sender}] [{message.id}]\r\n </a>\r\n </div>\r\n <div className=\"bottom-row\">\r\n <a>\r\n [team] [{message.date}]\r\n </a>\r\n </div>\r\n </div>\r\n <div>\r\n <FontAwesomeIcon className=\"entry-icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </div>\r\n </div>\r\n </div>\r\n )) : \"Loading messages\"}\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default Updates","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\signUp\\SignUp.js",["171","172","173","174"],"import React, { useState, useEffect, useRef } from 'react'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport config from '../../../config';\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./SignUp.css\"\r\n\r\nconst SignUp = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [sessionToken, setSessionToken] = useState()\r\n\r\n const [signUpFormVisibilityState, showSignUpForm] = useState(false)\r\n const signUpFormRef = useRef(null);\r\n const toggleSignUpFormVisible = () => showSignUpForm(!signUpFormVisibilityState)\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (signUpFormRef.current !== null && !signUpFormRef.current.contains(e.target)) {\r\n toggleSignUpFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (signUpFormVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [signUpFormVisibilityState]);\r\n\r\n const [firstname, setFirstname] = useState('')\r\n const [lastname, setLastname] = useState('')\r\n const [username, setUsername] = useState('');\r\n const [password, setPassword] = useState('');\r\n const [confirmPassword, setConfirmPassword] = useState('');\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`,\r\n password: `${password}`\r\n })\r\n\r\n const loginRequestOptions = {\r\n method: 'POST',\r\n body: userInputData\r\n };\r\n\r\n const handlefirstnameChange = (e) => {\r\n setFirstname(e.target.value)\r\n }\r\n\r\n const handlelastnameChange = (e) => {\r\n setLastname(e.target.value)\r\n }\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const handlePasswordChange = (e) => {\r\n setPassword(e.target.value)\r\n }\r\n\r\n const handleConfirmPasswordChange = (e) => {\r\n setConfirmPassword(e.target.value)\r\n }\r\n\r\n const handleSignUpFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n if (!password || !confirmPassword) {\r\n window.alert(\"A password field is blank\")\r\n return\r\n }\r\n\r\n if (!(confirmPassword.length >= 7)) {\r\n window.alert(\"Password must consist of 8 characters or more\")\r\n return\r\n }\r\n\r\n if (!(password == confirmPassword)) {\r\n window.alert(\"Passwords do not match\")\r\n return\r\n }\r\n\r\n else {\r\n fetch(config.serviceAPI.createNewUserURL, loginRequestOptions)\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 handleSignInFormSubmit(e)\r\n }\r\n })\r\n }\r\n }\r\n\r\n const handleSignInFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n oktaAuth.signInWithCredentials({ username, password })\r\n .then(res => {\r\n const sessionToken = res.sessionToken;\r\n setSessionToken(sessionToken);\r\n // sessionToken is a one-use token, so make sure this is only called once\r\n oktaAuth.signInWithRedirect({ sessionToken, originalUri: '/home' });\r\n })\r\n .catch(err => console.log('Found an error', err));\r\n };\r\n\r\n return (\r\n <div className=\"signUpContainer\">\r\n <div className={`modal ${signUpFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={signUpFormRef} className=\"modal-content\">\r\n <div className=\"signUpForm\">\r\n <h2>Sign Up</h2>\r\n <form onSubmit={handleSignUpFormSubmit}>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={password}\r\n onChange={handlePasswordChange} />\r\n </label>\r\n <label>\r\n Confirm Password:\r\n <input\r\n id=\"password\" type=\"password\"\r\n value={confirmPassword}\r\n onChange={handleConfirmPasswordChange} />\r\n </label>\r\n <label className=\"password-requirements\">\r\n Requirements: At least 8 characters, no parts of your username\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Sign Up&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"user-plus\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div className=\"spacer\">\r\n <div className=\"text-container\">\r\n <h1>Get started with PipIt</h1>\r\n <h5>Track bugs and usabilty issues</h5>\r\n <button className=\"signUpForm-show-button\" onClick={toggleSignUpFormVisible}>\r\n Sign up\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default SignUp\r\n","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\login\\passwordReset\\PasswordForgotModal.js",["175","176"],"import React, { useState, useRef, useEffect } from 'react'\r\nimport config from '../../../config'\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\r\nimport \"./PasswordForgotModal.css\"\r\nimport MessageModal from '../../../components/messageModal/MessageModal';\r\n\r\n\r\n// TODO : Clean up and make more like the message modal component\r\nconst PasswordForgotModal = () => {\r\n const [forgotPasswordFormVisibilityState, setForgotPasswordFormVisibilityState] = useState(false)\r\n const forgotPasswordFormRef = useRef(null)\r\n const toggleForgotPasswordFormVisible = () => setForgotPasswordFormVisibilityState(!forgotPasswordFormVisibilityState)\r\n\r\n const [submitOkMessageModalState, setSubmitOkMessageModalState] = useState(false);\r\n\r\n const [username, setUsername] = useState('');\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (forgotPasswordFormRef.current !== null && !forgotPasswordFormRef.current.contains(e.target)) {\r\n toggleForgotPasswordFormVisible()\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (forgotPasswordFormVisibilityState) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [forgotPasswordFormVisibilityState]);\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${username}`,\r\n })\r\n\r\n const ForgotPasswordRequestOptions = {\r\n method: 'PUT',\r\n body: userInputData\r\n }\r\n\r\n const handlePasswordForgot = (e) => {\r\n e.preventDefault();\r\n\r\n fetch(config.serviceAPI.forgotPasswordURL, ForgotPasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: something went wrong\")\r\n console.log(res)\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n toggleForgotPasswordFormVisible()\r\n setSubmitOkMessageModalState(true)\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div>\r\n <div className=\"password-forgot-prompt\">\r\n <span>\r\n <a onClick={toggleForgotPasswordFormVisible}>Forgot password</a>\r\n </span>\r\n </div>\r\n\r\n {/* Forgot password modal */}\r\n <div className={`modal ${forgotPasswordFormVisibilityState ? \"active\" : \"inactive\"}`}>\r\n <div ref={forgotPasswordFormRef} className=\"modal-content\">\r\n <div className=\"recoverPasswordForm\">\r\n <h2>Recover password</h2>\r\n <form onSubmit={handlePasswordForgot}>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <label>\r\n An email with a password recovery link will be sent if it is registered in our system\r\n </label>\r\n <button className=\"formSubmitButton\" type=\"submit\">\r\n Submit&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n <div className={`modal ${submitOkMessageModalState ? \"active\" : \"inactive\"}`}>\r\n <MessageModal removeModal={() => setSubmitOkMessageModalState(false)} headerMessage={\"Email submitted!\"} bodyMessage={\"An email with a password recovery link will be sent if it is registered in our system\"} />\r\n </div>\r\n </div>\r\n\r\n )\r\n}\r\n\r\nexport default PasswordForgotModal\r\n","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\navLinks\\NavLinks.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\logo\\Logo.js",["177","178"],"import React from 'react'\r\nimport { NavLink } from 'react-router-dom'\r\nimport \"./Logo.css\"\r\nimport logo_picture from \"../../../images/bird-logo.jpg\"\r\nimport logo_text from \"../../../images/logo-text.jpg\"\r\n\r\nconst Logo = () => {\r\n return (\r\n <h1 className=\"title\">\r\n <span className=\"title-icon\">\r\n <NavLink to=\"/home\" id=\"logo\">\r\n <img src={logo_picture} width=\"24\" height=\"24\"></img>\r\n <img src={logo_text} width=\"48\" height=\"24\"></img>\r\n </NavLink>\r\n </span>\r\n </h1>\r\n )\r\n}\r\n\r\nexport default Logo","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\searchbar\\Searchbar.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\navbar\\dropdownMenu\\NavbarDropdownMenu.js",["179"],"import React, { useRef, useState, useEffect } from 'react'\r\nimport { NavLink } from \"react-router-dom\";\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./NavbarDropdownMenu.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\n\r\n\r\nconst DropdownMenu = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n\r\n const dropdownRef = useRef(null);\r\n const [isActive, setIsActive] = useState(false);\r\n const onClick = () => setIsActive(!isActive);\r\n\r\n useEffect(() => {\r\n const pageClickEvent = (e) => {\r\n if (dropdownRef.current !== null && !dropdownRef.current.contains(e.target)) {\r\n setIsActive(!isActive);\r\n }\r\n };\r\n\r\n // If the item is active (ie open) then listen for clicks\r\n if (isActive) {\r\n window.addEventListener('click', pageClickEvent);\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('click', pageClickEvent);\r\n }\r\n\r\n }, [isActive]);\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 logout = () => {\r\n oktaAuth.signOut()\r\n }\r\n\r\n return (\r\n <li>\r\n <div className=\"navbar-user-dropdown-container\">\r\n <button className={`user-dropdown-menu-toggle-button ${isActive ? 'active' : 'inactive'}`} onClick={onClick} >\r\n <FontAwesomeIcon className=\"user-icon\" icon=\"user-circle\"></FontAwesomeIcon>\r\n <FontAwesomeIcon className=\"down-arrow\" icon=\"angle-down\"></FontAwesomeIcon>\r\n </button>\r\n {/* show submenu?*/}\r\n <div ref={dropdownRef} className={`user-dropDown-menu-content ${isActive ? 'active' : 'inactive'}`}>\r\n <ul>\r\n <li>\r\n <NavLink to=\"/account\" onClick={onClick} className=\"top-item\">\r\n <div>\r\n <FontAwesomeIcon icon=\"user\" className=\"item-icon-top\"></FontAwesomeIcon>&nbsp;&nbsp;\r\n </div>\r\n <div className=\"item-top-text\">\r\n <span>\r\n <p className=\"top-row\">Account</p>\r\n <p className=\"bottom-row\">{userInfo ? userInfo.email : \"...\"}</p>\r\n </span>\r\n </div>\r\n <div className=\"item-last-flex-item\">\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"item-icon-top\"></FontAwesomeIcon>\r\n </div>\r\n </NavLink>\r\n </li>\r\n <li>\r\n <NavLink to=\"/messages\" onClick={onClick}>\r\n <FontAwesomeIcon icon=\"envelope\"></FontAwesomeIcon>&nbsp;&nbsp;Messages\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </NavLink>\r\n </li>\r\n {/* <li>\r\n <a href=\"./\">\r\n <FontAwesomeIcon icon=\"sliders-h\"></FontAwesomeIcon>&nbsp;&nbsp;Preferences\r\n <FontAwesomeIcon icon=\"chevron-right\" className=\"arrow-right-icon\"></FontAwesomeIcon>\r\n </a>\r\n </li> */}\r\n <li>\r\n <a onClick={logout}>\r\n <FontAwesomeIcon icon=\"sign-out-alt\"></FontAwesomeIcon>&nbsp;&nbsp;Log out\r\n </a>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n </li >\r\n )\r\n}\r\n\r\nexport default DropdownMenu","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\activityChart\\ActivityChart.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\pages\\project\\projectInfo\\activitiesDisplay\\ActivitiesDisplay.js",["180","181","182","183"],"import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport React from 'react'\r\nimport \"./ActivitiesDisplay.css\"\r\n\r\nconst ActivitiesDisplay = () => {\r\n return (\r\n <div className=\"activity-new-issues-display-container\">\r\n\r\n <div className=\"new-issues-display-container\">\r\n <div className=\"new-issues-display-header\">\r\n <p>\r\n <FontAwesomeIcon icon=\"inbox\"></FontAwesomeIcon>\r\n &nbsp;&nbsp;New issue reports\r\n </p>\r\n </div>\r\n <div className=\"new-issues-display-content\">\r\n <div className=\"new-issue-report-entry\">\r\n <div className=\"entry-text\">\r\n <div className=\"upper-row\">\r\n <a>\r\n [Severity] [type]\r\n </a>\r\n </div>\r\n <div className=\"bottom-row\">\r\n <a>\r\n [project] [time]\r\n </a>\r\n </div>\r\n </div>\r\n <div>\r\n <FontAwesomeIcon className=\"entry-icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div className=\"activity-display-container\">\r\n <div className=\"activity-display-header\">\r\n <p>\r\n <FontAwesomeIcon icon=\"sticky-note\"></FontAwesomeIcon>\r\n &nbsp;&nbsp;Recent Team activities\r\n </p>\r\n </div>\r\n <div className=\"activity-display-content\">\r\n <div className=\"new-issue-report-entry\">\r\n <div className=\"entry-text\">\r\n <div className=\"upper-row\">\r\n <a>\r\n [Name] [action]\r\n </a>\r\n </div>\r\n <div className=\"bottom-row\">\r\n <a>\r\n [project] [time]\r\n </a>\r\n </div>\r\n </div>\r\n <div>\r\n <FontAwesomeIcon className=\"entry-icon\" icon=\"chevron-right\"></FontAwesomeIcon>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default ActivitiesDisplay","C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\updateUserData\\updateUserDataModal\\UpdateUserDataModal.js",[],"C:\\Users\\Bruger\\Desktop\\Web-projects\\pipit\\client\\src\\components\\messageModal\\MessageModal.js",[],{"ruleId":"184","replacedBy":"185"},{"ruleId":"186","replacedBy":"187"},{"ruleId":"188","severity":1,"message":"189","line":1,"column":1,"nodeType":"190","endLine":17,"endColumn":3},{"ruleId":"191","severity":1,"message":"192","line":20,"column":70,"nodeType":"193","messageId":"194","endLine":20,"endColumn":72},{"ruleId":"195","severity":1,"message":"196","line":1,"column":17,"nodeType":"197","messageId":"198","endLine":1,"endColumn":25},{"ruleId":"195","severity":1,"message":"196","line":2,"column":17,"nodeType":"197","messageId":"198","endLine":2,"endColumn":25},{"ruleId":"195","severity":1,"message":"199","line":2,"column":27,"nodeType":"197","messageId":"198","endLine":2,"endColumn":36},{"ruleId":"195","severity":1,"message":"200","line":5,"column":8,"nodeType":"197","messageId":"198","endLine":5,"endColumn":33},{"ruleId":"195","severity":1,"message":"199","line":1,"column":27,"nodeType":"197","messageId":"198","endLine":1,"endColumn":36},{"ruleId":"195","severity":1,"message":"201","line":1,"column":38,"nodeType":"197","messageId":"198","endLine":1,"endColumn":44},{"ruleId":"195","severity":1,"message":"202","line":6,"column":10,"nodeType":"197","messageId":"198","endLine":6,"endColumn":17},{"ruleId":"195","severity":1,"message":"203","line":7,"column":8,"nodeType":"197","messageId":"198","endLine":7,"endColumn":14},{"ruleId":"195","severity":1,"message":"204","line":8,"column":8,"nodeType":"197","messageId":"198","endLine":8,"endColumn":14},{"ruleId":"195","severity":1,"message":"205","line":32,"column":9,"nodeType":"197","messageId":"198","endLine":32,"endColumn":28},{"ruleId":"206","severity":1,"message":"207","line":75,"column":11,"nodeType":"208","endLine":75,"endColumn":123},{"ruleId":"206","severity":1,"message":"207","line":76,"column":11,"nodeType":"208","endLine":76,"endColumn":127},{"ruleId":"195","severity":1,"message":"209","line":8,"column":9,"nodeType":"197","messageId":"198","endLine":8,"endColumn":25},{"ruleId":"195","severity":1,"message":"210","line":13,"column":9,"nodeType":"197","messageId":"198","endLine":13,"endColumn":23},{"ruleId":"206","severity":1,"message":"207","line":43,"column":19,"nodeType":"208","endLine":43,"endColumn":22},{"ruleId":"211","severity":1,"message":"212","line":47,"column":6,"nodeType":"213","endLine":47,"endColumn":17,"suggestions":"214"},{"ruleId":"195","severity":1,"message":"215","line":11,"column":9,"nodeType":"197","messageId":"198","endLine":11,"endColumn":17},{"ruleId":"195","severity":1,"message":"196","line":1,"column":17,"nodeType":"197","messageId":"198","endLine":1,"endColumn":25},{"ruleId":"206","severity":1,"message":"207","line":29,"column":13,"nodeType":"208","endLine":29,"endColumn":16},{"ruleId":"206","severity":1,"message":"207","line":39,"column":19,"nodeType":"208","endLine":39,"endColumn":22},{"ruleId":"206","severity":1,"message":"207","line":50,"column":13,"nodeType":"208","endLine":50,"endColumn":16},{"ruleId":"206","severity":1,"message":"207","line":60,"column":19,"nodeType":"208","endLine":60,"endColumn":22},{"ruleId":"206","severity":1,"message":"207","line":70,"column":25,"nodeType":"208","endLine":70,"endColumn":28},{"ruleId":"206","severity":1,"message":"207","line":23,"column":17,"nodeType":"208","endLine":23,"endColumn":20},{"ruleId":"206","severity":1,"message":"207","line":28,"column":17,"nodeType":"208","endLine":28,"endColumn":20},{"ruleId":"206","severity":1,"message":"207","line":52,"column":19,"nodeType":"208","endLine":52,"endColumn":22},{"ruleId":"206","severity":1,"message":"207","line":57,"column":19,"nodeType":"208","endLine":57,"endColumn":22},{"ruleId":"195","severity":1,"message":"216","line":8,"column":11,"nodeType":"197","messageId":"198","endLine":8,"endColumn":20},{"ruleId":"195","severity":1,"message":"217","line":9,"column":10,"nodeType":"197","messageId":"198","endLine":9,"endColumn":22},{"ruleId":"211","severity":1,"message":"218","line":31,"column":6,"nodeType":"213","endLine":31,"endColumn":33,"suggestions":"219"},{"ruleId":"191","severity":1,"message":"192","line":84,"column":20,"nodeType":"193","messageId":"194","endLine":84,"endColumn":22},{"ruleId":"211","severity":1,"message":"220","line":38,"column":6,"nodeType":"213","endLine":38,"endColumn":41,"suggestions":"221"},{"ruleId":"206","severity":1,"message":"207","line":71,"column":11,"nodeType":"208","endLine":71,"endColumn":56},{"ruleId":"222","severity":1,"message":"223","line":12,"column":11,"nodeType":"208","endLine":12,"endColumn":58},{"ruleId":"222","severity":1,"message":"223","line":13,"column":11,"nodeType":"208","endLine":13,"endColumn":55},{"ruleId":"206","severity":1,"message":"207","line":88,"column":15,"nodeType":"208","endLine":88,"endColumn":35},{"ruleId":"206","severity":1,"message":"207","line":20,"column":17,"nodeType":"208","endLine":20,"endColumn":20},{"ruleId":"206","severity":1,"message":"207","line":25,"column":17,"nodeType":"208","endLine":25,"endColumn":20},{"ruleId":"206","severity":1,"message":"207","line":48,"column":17,"nodeType":"208","endLine":48,"endColumn":20},{"ruleId":"206","severity":1,"message":"207","line":53,"column":17,"nodeType":"208","endLine":53,"endColumn":20},"no-native-reassign",["224"],"no-negated-in-lhs",["225"],"import/no-anonymous-default-export","Assign object to a variable before exporting as module default","ExportDefaultDeclaration","eqeqeq","Expected '===' and instead saw '=='.","BinaryExpression","unexpected","no-unused-vars","'useState' is defined but never used.","Identifier","unusedVar","'useEffect' is defined but never used.","'ConfirmRemoveAccountModal' is defined but never used.","'useRef' is defined but never used.","'NavLink' is defined but never used.","'signUp' is defined but never used.","'config' is defined but never used.","'loginRequestOptions' is assigned a value but never used.","jsx-a11y/anchor-is-valid","The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md","JSXOpeningElement","'personalProjects' is assigned a value but never used.","'sharedProjects' is assigned a value but never used.","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'oktaAuth'. Either include it or remove the dependency array.","ArrayExpression",["226"],"'stopProp' is assigned a value but never used.","'authState' is assigned a value but never used.","'sessionToken' is assigned a value but never used.","React Hook useEffect has a missing dependency: 'toggleSignUpFormVisible'. Either include it or remove the dependency array.",["227"],"React Hook useEffect has a missing dependency: 'toggleForgotPasswordFormVisible'. Either include it or remove the dependency array.",["228"],"jsx-a11y/alt-text","img elements must have an alt prop, either with meaningful text, or an empty string for decorative images.","no-global-assign","no-unsafe-negation",{"desc":"229","fix":"230"},{"desc":"231","fix":"232"},{"desc":"233","fix":"234"},"Update the dependencies array to be: [authState, oktaAuth]",{"range":"235","text":"236"},"Update the dependencies array to be: [signUpFormVisibilityState, toggleSignUpFormVisible]",{"range":"237","text":"238"},"Update the dependencies array to be: [forgotPasswordFormVisibilityState, toggleForgotPasswordFormVisible]",{"range":"239","text":"240"},[1422,1433],"[authState, oktaAuth]",[1028,1055],"[signUpFormVisibilityState, toggleSignUpFormVisible]",[1372,1407],"[forgotPasswordFormVisibilityState, toggleForgotPasswordFormVisible]"]
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\updateUserData\\\\updateUserDataModal\\\\UpdateUserDataModal.js\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect } from 'react';\nimport \"./UpdateUserDataModal.css\";\nimport { useOktaAuth } from '@okta/okta-react';\nimport config from '../../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst UpdateUserDataModal = ({\n removeModal\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n const accessToken = oktaAuth.getAccessToken();\n\n const stopProp = e => {\n e.stopPropagation();\n e.preventDefault();\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 useEffect(() => {\n userInfo && setFirstname(userInfo.given_name);\n userInfo && setLastname(userInfo.family_name);\n userInfo && setUsername(userInfo.email);\n }, [userInfo]);\n const [firstname, setFirstname] = useState('');\n const [lastname, setLastname] = useState('');\n const [username, setUsername] = useState('');\n\n const handlefirstnameChange = e => {\n setFirstname(e.target.value);\n };\n\n const handlelastnameChange = e => {\n setLastname(e.target.value);\n };\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const userInputData = JSON.stringify({\n firstname: `${firstname}`,\n lastname: `${lastname}`,\n email: `${username}`\n });\n const updateUserDataRequestOptions = {\n method: 'PUT',\n headers: {\n Authorization: `Bearer ${accessToken}`\n },\n body: userInputData\n };\n\n const handleUpdateUserDataFormSubmit = e => {\n e.preventDefault();\n fetch(config.serviceAPI.updateUserDataURL, updateUserDataRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n removeModal();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"updateUserDataModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Update information\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n userDataSubmitForm: true,\n children: /*#__PURE__*/_jsxDEV(\"form\", {\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"First name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"firstname\",\n type: \"text\",\n value: firstname,\n onChange: handlefirstnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 93,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Last Name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"lastname\",\n type: \"text\",\n value: lastname,\n onChange: handlelastnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 102,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 100,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 109,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 107,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"Cancel\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 115,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n onClick: handleUpdateUserDataFormSubmit,\n children: \"Update\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 118,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 114,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 92,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 91,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 5\n }, this);\n};\n\n_s(UpdateUserDataModal, \"AxzdzHC979Yq9E6/6HJDjeCl4CA=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = UpdateUserDataModal;\nexport default UpdateUserDataModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"UpdateUserDataModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/updateUserData/updateUserDataModal/UpdateUserDataModal.js"],"names":["React","useState","useEffect","useOktaAuth","config","UpdateUserDataModal","removeModal","authState","oktaAuth","userInfo","setUserInfo","accessToken","getAccessToken","stopProp","e","stopPropagation","preventDefault","isAuthenticated","getUser","then","info","setFirstname","given_name","setLastname","family_name","setUsername","email","firstname","lastname","username","handlefirstnameChange","target","value","handlelastnameChange","handleUsernameChange","userInputData","JSON","stringify","updateUserDataRequestOptions","method","headers","Authorization","body","handleUpdateUserDataFormSubmit","fetch","serviceAPI","updateUserDataURL","res","ok","window","alert","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,OAAO,2BAAP;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAOC,MAAP,MAAmB,iBAAnB;;;AAEA,MAAMC,mBAAmB,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAqB;AAAA;;AAC/C,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BL,WAAW,EAA3C;AACA,QAAM,CAACM,QAAD,EAAWC,WAAX,IAA0BT,QAAQ,CAAC,IAAD,CAAxC;AACA,QAAMU,WAAW,GAAGH,QAAQ,CAACI,cAAT,EAApB;;AAEA,QAAMC,QAAQ,GAAGC,CAAC,IAAI;AACpBA,IAAAA,CAAC,CAACC,eAAF;AACAD,IAAAA,CAAC,CAACE,cAAF;AACD,GAHD;;AAKAd,EAAAA,SAAS,CAAC,MAAM;AACd,QAAI,CAACK,SAAS,CAACU,eAAf,EAAgC;AAC9B;AACAP,MAAAA,WAAW,CAAC,IAAD,CAAX;AACD,KAHD,MAGO;AACLF,MAAAA,QAAQ,CAACU,OAAT,GAAmBC,IAAnB,CAAwBC,IAAI,IAAI;AAC9BV,QAAAA,WAAW,CA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AAA,KAAK,EAAEJ,QAFT;AAGE,cAAA,QAAQ,EAAEK;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF,eAsBE;AAAK,YAAA,SAAS,EAAC,iBAAf;AAAA,oCACE;AAAQ,cAAA,SAAS,EAAC,UAAlB;AAA6B,cAAA,OAAO,EAAEpB,CAAC,IAAIR,WAAW,EAAtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBADF,eAIE;AAAQ,cAAA,SAAS,EAAC,WAAlB;AAA8B,cAAA,OAAO,EAAEqC,8BAAvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAJF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAtBF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,cAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAwCD,CAzHD;;GAAMtC,mB;UAC4BF,W;;;KAD5BE,mB;AA2HN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useEffect } from 'react'\r\nimport \"./UpdateUserDataModal.css\"\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport config from '../../../config';\r\n\r\nconst UpdateUserDataModal = ({ removeModal }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n const accessToken = oktaAuth.getAccessToken();\r\n\r\n const stopProp = e => {\r\n e.stopPropagation()\r\n e.preventDefault()\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 useEffect(() => {\r\n userInfo && (\r\n setFirstname(userInfo.given_name)\r\n )\r\n\r\n userInfo && (\r\n setLastname(userInfo.family_name)\r\n )\r\n\r\n userInfo && (\r\n setUsername(userInfo.email)\r\n )\r\n }, [userInfo])\r\n\r\n const [firstname, setFirstname] = useState('')\r\n const [lastname, setLastname] = useState('')\r\n const [username, setUsername] = useState('');\r\n\r\n const handlefirstnameChange = (e) => {\r\n setFirstname(e.target.value)\r\n }\r\n\r\n const handlelastnameChange = (e) => {\r\n setLastname(e.target.value)\r\n }\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`\r\n })\r\n\r\n const updateUserDataRequestOptions = {\r\n method: 'PUT',\r\n headers: {\r\n Authorization: `Bearer ${accessToken}`,\r\n },\r\n body: userInputData\r\n };\r\n\r\n const handleUpdateUserDataFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n fetch(config.serviceAPI.updateUserDataURL, updateUserDataRequestOptions)\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 removeModal()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"updateUserDataModal\">\r\n <h2>Update information</h2>\r\n <div userDataSubmitForm>\r\n <form>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n Cancel\r\n </button>\r\n <button className=\"yesButton\" onClick={handleUpdateUserDataFormSubmit}>\r\n Update\r\n </button>\r\n </div>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default UpdateUserDataModal\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\\\\messageModal\\\\MessageModal.js\";\nimport React from 'react';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst MessageModal = ({\n removeModal,\n headerMessage,\n bodyMessage\n}) => {\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"submitOkModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: headerMessage\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 8,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: bodyMessage\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 9,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"formSubmitButton\",\n onClick: e => removeModal(),\n children: \"Ok\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 12,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 7,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 6,\n columnNumber: 5\n }, this);\n};\n\n_c = MessageModal;\nexport default MessageModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"MessageModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/messageModal/MessageModal.js"],"names":["React","MessageModal","removeModal","headerMessage","bodyMessage","e"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;;;AAEA,MAAMC,YAAY,GAAG,CAAC;AAAEC,EAAAA,WAAF;AAAeC,EAAAA,aAAf;AAA8BC,EAAAA;AAA9B,CAAD,KAAiD;AAEpE,sBACE;AAAK,IAAA,SAAS,EAAC,eAAf;AAAA,2BACE;AAAK,MAAA,SAAS,EAAC,eAAf;AAAA,8BACE;AAAA,kBAAKD;AAAL;AAAA;AAAA;AAAA;AAAA,cADF,eAEE;AAAA,kBACGC;AADH;AAAA;AAAA;AAAA;AAAA,cAFF,eAKE;AAAQ,QAAA,SAAS,EAAC,kBAAlB;AAAqC,QAAA,OAAO,EAAEC,CAAC,IAAIH,WAAW,EAA9D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cALF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAaD,CAfD;;KAAMD,Y;AAiBN,eAAeA,YAAf","sourcesContent":["import React from 'react'\r\n\r\nconst MessageModal = ({ removeModal, headerMessage, bodyMessage }) => {\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"submitOkModal\">\r\n <h2>{headerMessage}</h2>\r\n <label>\r\n {bodyMessage}\r\n </label>\r\n <button className=\"formSubmitButton\" onClick={e => removeModal()}>\r\n Ok\r\n </button>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default MessageModal\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\\\\updateUserData\\\\updateUserDataModal\\\\UpdateUserDataModal.js\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect } from 'react';\nimport \"./UpdateUserDataModal.css\";\nimport { useOktaAuth } from '@okta/okta-react';\nimport config from '../../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst UpdateUserDataModal = ({\n removeModal\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n const accessToken = oktaAuth.getAccessToken();\n\n const stopProp = e => {\n e.preventDefault();\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 useEffect(() => {\n userInfo && setFirstname(userInfo.given_name);\n userInfo && setLastname(userInfo.family_name);\n userInfo && setUsername(userInfo.email);\n }, [userInfo]);\n const [firstname, setFirstname] = useState('');\n const [lastname, setLastname] = useState('');\n const [username, setUsername] = useState('');\n\n const handlefirstnameChange = e => {\n setFirstname(e.target.value);\n };\n\n const handlelastnameChange = e => {\n setLastname(e.target.value);\n };\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const userInputData = JSON.stringify({\n firstname: `${firstname}`,\n lastname: `${lastname}`,\n email: `${username}`\n });\n const updateUserDataRequestOptions = {\n method: 'PUT',\n headers: {\n Authorization: `Bearer ${accessToken}`\n },\n body: userInputData\n };\n\n const handleUpdateUserDataFormSubmit = e => {\n e.preventDefault();\n fetch(config.serviceAPI.updateUserDataURL, updateUserDataRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n removeModal();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"updateUserDataModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Update information\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n userDataSubmitForm: true,\n children: /*#__PURE__*/_jsxDEV(\"form\", {\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"First name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"firstname\",\n type: \"text\",\n value: firstname,\n onChange: handlefirstnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 93,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Last Name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"lastname\",\n type: \"text\",\n value: lastname,\n onChange: handlelastnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 102,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 100,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 109,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 107,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: stopProp,\n children: \"Cancel\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 115,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n onClick: handleUpdateUserDataFormSubmit,\n children: \"Update\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 118,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 114,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 92,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 91,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 5\n }, this);\n};\n\n_s(UpdateUserDataModal, \"AxzdzHC979Yq9E6/6HJDjeCl4CA=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = UpdateUserDataModal;\nexport default UpdateUserDataModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"UpdateUserDataModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/updateUserData/updateUserDataModal/UpdateUserDataModal.js"],"names":["React","useState","useEffect","useOktaAuth","config","UpdateUserDataModal","removeModal","authState","oktaAuth","userInfo","setUserInfo","accessToken","getAccessToken","stopProp","e","preventDefault","stopPropagation","isAuthenticated","getUser","then","info","setFirstname","given_name","setLastname","family_name","setUsername","email","firstname","lastname","username","handlefirstnameChange","target","value","handlelastnameChange","handleUsernameChange","userInputData","JSON","stringify","updateUserDataRequestOptions","method","headers","Authorization","body","handleUpdateUserDataFormSubmit","fetch","serviceAPI","updateUserDataURL","res","ok","window","alert","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,OAAO,2BAAP;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAOC,MAAP,MAAmB,iBAAnB;;;AAEA,MAAMC,mBAAmB,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAqB;AAAA;;AAC/C,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BL,WAAW,EAA3C;AACA,QAAM,CAACM,QAAD,EAAWC,WAAX,IAA0BT,QAAQ,CAAC,IAAD,CAAxC;AACA,QAAMU,WAAW,GAAGH,QAAQ,CAACI,cAAT,EAApB;;AAEA,QAAMC,QAAQ,GAAGC,CAAC,IAAI;AACpBA,IAAAA,CAAC,CAACC,cAAF;AACAD,IAAAA,CAAC,CAACE,eAAF;AACD,GAHD;;AAKAd,EAAAA,SAAS,CAAC,MAAM;AACd,QAAI,CAACK,SAAS,CAACU,eAAf,EAAgC;AAC9B;AACAP,MAA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AAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBARF,eAeE;AAAA,8CAEE;AACE,cAAA,EAAE,EAAC,OADL;AACa,cAAA,IAAI,EAAC,MADlB;AAEE,cAAA,KAAK,EAAEJ,QAFT;AAGE,cAAA,QAAQ,EAAEK;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF,eAsBE;AAAK,YAAA,SAAS,EAAC,iBAAf;AAAA,oCACE;AAAQ,cAAA,SAAS,EAAC,UAAlB;AAA6B,cAAA,OAAO,EAAErB,QAAtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBADF,eAIE;AAAQ,cAAA,SAAS,EAAC,WAAlB;AAA8B,cAAA,OAAO,EAAE8B,8BAAvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAJF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAtBF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,cAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAwCD,CAzHD;;GAAMtC,mB;UAC4BF,W;;;KAD5BE,mB;AA2HN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useEffect } from 'react'\r\nimport \"./UpdateUserDataModal.css\"\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport config from '../../../config';\r\n\r\nconst UpdateUserDataModal = ({ removeModal }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n const accessToken = oktaAuth.getAccessToken();\r\n\r\n const stopProp = e => {\r\n e.preventDefault()\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 useEffect(() => {\r\n userInfo && (\r\n setFirstname(userInfo.given_name)\r\n )\r\n\r\n userInfo && (\r\n setLastname(userInfo.family_name)\r\n )\r\n\r\n userInfo && (\r\n setUsername(userInfo.email)\r\n )\r\n }, [userInfo])\r\n\r\n const [firstname, setFirstname] = useState('')\r\n const [lastname, setLastname] = useState('')\r\n const [username, setUsername] = useState('');\r\n\r\n const handlefirstnameChange = (e) => {\r\n setFirstname(e.target.value)\r\n }\r\n\r\n const handlelastnameChange = (e) => {\r\n setLastname(e.target.value)\r\n }\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`\r\n })\r\n\r\n const updateUserDataRequestOptions = {\r\n method: 'PUT',\r\n headers: {\r\n Authorization: `Bearer ${accessToken}`,\r\n },\r\n body: userInputData\r\n };\r\n\r\n const handleUpdateUserDataFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n fetch(config.serviceAPI.updateUserDataURL, updateUserDataRequestOptions)\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 removeModal()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"updateUserDataModal\">\r\n <h2>Update information</h2>\r\n <div userDataSubmitForm>\r\n <form>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={stopProp}>\r\n Cancel\r\n </button>\r\n <button className=\"yesButton\" onClick={handleUpdateUserDataFormSubmit}>\r\n Update\r\n </button>\r\n </div>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default UpdateUserDataModal\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\\\\updateUserData\\\\updateUserDataModal\\\\UpdateUserDataModal.js\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect } from 'react';\nimport \"./UpdateUserDataModal.css\";\nimport { useOktaAuth } from '@okta/okta-react';\nimport config from '../../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst UpdateUserDataModal = ({\n removeModal\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n const accessToken = oktaAuth.getAccessToken();\n\n const stopProp = e => {\n // e.stopPropagation()\n e.preventDefault();\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 useEffect(() => {\n userInfo && setFirstname(userInfo.given_name);\n userInfo && setLastname(userInfo.family_name);\n userInfo && setUsername(userInfo.email);\n }, [userInfo]);\n const [firstname, setFirstname] = useState('');\n const [lastname, setLastname] = useState('');\n const [username, setUsername] = useState('');\n\n const handlefirstnameChange = e => {\n setFirstname(e.target.value);\n };\n\n const handlelastnameChange = e => {\n setLastname(e.target.value);\n };\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const userInputData = JSON.stringify({\n firstname: `${firstname}`,\n lastname: `${lastname}`,\n email: `${username}`\n });\n const updateUserDataRequestOptions = {\n method: 'PUT',\n headers: {\n Authorization: `Bearer ${accessToken}`\n },\n body: userInputData\n };\n\n const handleUpdateUserDataFormSubmit = e => {\n e.preventDefault();\n fetch(config.serviceAPI.updateUserDataURL, updateUserDataRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n removeModal();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"updateUserDataModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Update information\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n userDataSubmitForm: true,\n children: /*#__PURE__*/_jsxDEV(\"form\", {\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"First name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"firstname\",\n type: \"text\",\n value: firstname,\n onChange: handlefirstnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 93,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Last Name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"lastname\",\n type: \"text\",\n value: lastname,\n onChange: handlelastnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 102,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 100,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 109,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 107,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"Cancel\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 115,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n onClick: handleUpdateUserDataFormSubmit,\n children: \"Update\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 118,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 114,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 92,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 91,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 5\n }, this);\n};\n\n_s(UpdateUserDataModal, \"AxzdzHC979Yq9E6/6HJDjeCl4CA=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = UpdateUserDataModal;\nexport default UpdateUserDataModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"UpdateUserDataModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/updateUserData/updateUserDataModal/UpdateUserDataModal.js"],"names":["React","useState","useEffect","useOktaAuth","config","UpdateUserDataModal","removeModal","authState","oktaAuth","userInfo","setUserInfo","accessToken","getAccessToken","stopProp","e","preventDefault","isAuthenticated","getUser","then","info","setFirstname","given_name","setLastname","family_name","setUsername","email","firstname","lastname","username","handlefirstnameChange","target","value","handlelastnameChange","handleUsernameChange","userInputData","JSON","stringify","updateUserDataRequestOptions","method","headers","Authorization","body","handleUpdateUserDataFormSubmit","fetch","serviceAPI","upd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AAA,kBAtBF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,cAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAwCD,CAzHD;;GAAMrC,mB;UAC4BF,W;;;KAD5BE,mB;AA2HN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useEffect } from 'react'\r\nimport \"./UpdateUserDataModal.css\"\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport config from '../../../config';\r\n\r\nconst UpdateUserDataModal = ({ removeModal }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n const accessToken = oktaAuth.getAccessToken();\r\n\r\n const stopProp = e => {\r\n // e.stopPropagation()\r\n e.preventDefault()\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 useEffect(() => {\r\n userInfo && (\r\n setFirstname(userInfo.given_name)\r\n )\r\n\r\n userInfo && (\r\n setLastname(userInfo.family_name)\r\n )\r\n\r\n userInfo && (\r\n setUsername(userInfo.email)\r\n )\r\n }, [userInfo])\r\n\r\n const [firstname, setFirstname] = useState('')\r\n const [lastname, setLastname] = useState('')\r\n const [username, setUsername] = useState('');\r\n\r\n const handlefirstnameChange = (e) => {\r\n setFirstname(e.target.value)\r\n }\r\n\r\n const handlelastnameChange = (e) => {\r\n setLastname(e.target.value)\r\n }\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`\r\n })\r\n\r\n const updateUserDataRequestOptions = {\r\n method: 'PUT',\r\n headers: {\r\n Authorization: `Bearer ${accessToken}`,\r\n },\r\n body: userInputData\r\n };\r\n\r\n const handleUpdateUserDataFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n fetch(config.serviceAPI.updateUserDataURL, updateUserDataRequestOptions)\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 removeModal()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"updateUserDataModal\">\r\n <h2>Update information</h2>\r\n <div userDataSubmitForm>\r\n <form>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n Cancel\r\n </button>\r\n <button className=\"yesButton\" onClick={handleUpdateUserDataFormSubmit}>\r\n Update\r\n </button>\r\n </div>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default UpdateUserDataModal\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\\\\updateUserData\\\\updateUserDataModal\\\\UpdateUserDataModal.js\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect } from 'react';\nimport \"./UpdateUserDataModal.css\";\nimport { useOktaAuth } from '@okta/okta-react';\nimport config from '../../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst UpdateUserDataModal = ({\n removeModal\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n const accessToken = oktaAuth.getAccessToken();\n\n const stopProp = e => {\n e.preventDefault();\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 useEffect(() => {\n userInfo && setFirstname(userInfo.given_name);\n userInfo && setLastname(userInfo.family_name);\n userInfo && setUsername(userInfo.email);\n }, [userInfo]);\n const [firstname, setFirstname] = useState('');\n const [lastname, setLastname] = useState('');\n const [username, setUsername] = useState('');\n\n const handlefirstnameChange = e => {\n setFirstname(e.target.value);\n };\n\n const handlelastnameChange = e => {\n setLastname(e.target.value);\n };\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const userInputData = JSON.stringify({\n firstname: `${firstname}`,\n lastname: `${lastname}`,\n email: `${username}`\n });\n const updateUserDataRequestOptions = {\n method: 'PUT',\n headers: {\n Authorization: `Bearer ${accessToken}`\n },\n body: userInputData\n };\n\n const handleUpdateUserDataFormSubmit = e => {\n e.preventDefault();\n fetch(config.serviceAPI.updateUserDataURL, updateUserDataRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n removeModal();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"updateUserDataModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Update information\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n userDataSubmitForm: true,\n children: /*#__PURE__*/_jsxDEV(\"form\", {\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"First name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"firstname\",\n type: \"text\",\n value: firstname,\n onChange: handlefirstnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 93,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Last Name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"lastname\",\n type: \"text\",\n value: lastname,\n onChange: handlelastnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 102,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 100,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 109,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 107,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"Cancel\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 115,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n onClick: handleUpdateUserDataFormSubmit,\n children: \"Update\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 118,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 114,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 92,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 91,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 5\n }, this);\n};\n\n_s(UpdateUserDataModal, \"AxzdzHC979Yq9E6/6HJDjeCl4CA=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = UpdateUserDataModal;\nexport default UpdateUserDataModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"UpdateUserDataModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/updateUserData/updateUserDataModal/UpdateUserDataModal.js"],"names":["React","useState","useEffect","useOktaAuth","config","UpdateUserDataModal","removeModal","authState","oktaAuth","userInfo","setUserInfo","accessToken","getAccessToken","stopProp","e","preventDefault","stopPropagation","isAuthenticated","getUser","then","info","setFirstname","given_name","setLastname","family_name","setUsername","email","firstname","lastname","username","handlefirstnameChange","target","value","handlelastnameChange","handleUsernameChange","userInputData","JSON","stringify","updateUserDataRequestOptions","method","headers","Authorization","body","handleUpdateUserDataFormSubmit","fetch","serviceAPI","updateUserDataURL","res","ok","window","alert","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,OAAO,2BAAP;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAOC,MAAP,MAAmB,iBAAnB;;;AAEA,MAAMC,mBAAmB,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAqB;AAAA;;AAC/C,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BL,WAAW,EAA3C;AACA,QAAM,CAACM,QAAD,EAAWC,WAAX,IAA0BT,QAAQ,CAAC,IAAD,CAAxC;AACA,QAAMU,WAAW,GAAGH,QAAQ,CAACI,cAAT,EAApB;;AAEA,QAAMC,QAAQ,GAAGC,CAAC,IAAI;AACpBA,IAAAA,CAAC,CAACC,cAAF;AACAD,IAAAA,CAA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AAC,UADL;AACgB,cAAA,IAAI,EAAC,MADrB;AAEE,cAAA,KAAK,EAAEF,QAFT;AAGE,cAAA,QAAQ,EAAEK;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBARF,eAeE;AAAA,8CAEE;AACE,cAAA,EAAE,EAAC,OADL;AACa,cAAA,IAAI,EAAC,MADlB;AAEE,cAAA,KAAK,EAAEJ,QAFT;AAGE,cAAA,QAAQ,EAAEK;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF,eAsBE;AAAK,YAAA,SAAS,EAAC,iBAAf;AAAA,oCACE;AAAQ,cAAA,SAAS,EAAC,UAAlB;AAA6B,cAAA,OAAO,EAAEpB,CAAC,IAAIR,WAAW,EAAtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBADF,eAIE;AAAQ,cAAA,SAAS,EAAC,WAAlB;AAA8B,cAAA,OAAO,EAAEqC,8BAAvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAJF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAtBF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,cAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAwCD,CAzHD;;GAAMtC,mB;UAC4BF,W;;;KAD5BE,mB;AA2HN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useEffect } from 'react'\r\nimport \"./UpdateUserDataModal.css\"\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport config from '../../../config';\r\n\r\nconst UpdateUserDataModal = ({ removeModal }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n const accessToken = oktaAuth.getAccessToken();\r\n\r\n const stopProp = e => {\r\n e.preventDefault()\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 useEffect(() => {\r\n userInfo && (\r\n setFirstname(userInfo.given_name)\r\n )\r\n\r\n userInfo && (\r\n setLastname(userInfo.family_name)\r\n )\r\n\r\n userInfo && (\r\n setUsername(userInfo.email)\r\n )\r\n }, [userInfo])\r\n\r\n const [firstname, setFirstname] = useState('')\r\n const [lastname, setLastname] = useState('')\r\n const [username, setUsername] = useState('');\r\n\r\n const handlefirstnameChange = (e) => {\r\n setFirstname(e.target.value)\r\n }\r\n\r\n const handlelastnameChange = (e) => {\r\n setLastname(e.target.value)\r\n }\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`\r\n })\r\n\r\n const updateUserDataRequestOptions = {\r\n method: 'PUT',\r\n headers: {\r\n Authorization: `Bearer ${accessToken}`,\r\n },\r\n body: userInputData\r\n };\r\n\r\n const handleUpdateUserDataFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n fetch(config.serviceAPI.updateUserDataURL, updateUserDataRequestOptions)\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 removeModal()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"updateUserDataModal\">\r\n <h2>Update information</h2>\r\n <div userDataSubmitForm>\r\n <form>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n Cancel\r\n </button>\r\n <button className=\"yesButton\" onClick={handleUpdateUserDataFormSubmit}>\r\n Update\r\n </button>\r\n </div>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default UpdateUserDataModal\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\\\\navbar\\\\Navbar.js\",\n _s = $RefreshSig$();\n\nimport React from 'react';\nimport { useOktaAuth } from '@okta/okta-react';\nimport \"./Navbar.css\";\nimport Logo from './logo/Logo';\nimport NavLinks from './navLinks/NavLinks';\nimport Searchbar from './searchbar/Searchbar';\nimport NavbarDropdownMenu from './dropdownMenu/NavbarDropdownMenu';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Navbar = () => {\n _s();\n\n const {\n authState\n } = useOktaAuth();\n\n if (!authState || !authState.isAuthenticated) {\n return null;\n }\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"navbar\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"header-content\",\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"title-navigation-links-container\",\n children: [/*#__PURE__*/_jsxDEV(Logo, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 20,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(NavLinks, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 21,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 19,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"searchbar-profile-container\",\n children: /*#__PURE__*/_jsxDEV(\"ul\", {\n className: \"right-unstyled-navbar\",\n children: [/*#__PURE__*/_jsxDEV(Searchbar, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 25,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(NavbarDropdownMenu, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 26,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 24,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 23,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 18,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 17,\n columnNumber: 5\n }, this);\n};\n\n_s(Navbar, \"oAW1RknmsiQ8MLimpuaVoCQZavU=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = Navbar;\nexport default Navbar;\n\nvar _c;\n\n$RefreshReg$(_c, \"Navbar\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/navbar/Navbar.js"],"names":["React","useOktaAuth","Logo","NavLinks","Searchbar","NavbarDropdownMenu","Navbar","authState","isAuthenticated"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,cAAP;AACA,OAAOC,IAAP,MAAiB,aAAjB;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,SAAP,MAAsB,uBAAtB;AACA,OAAOC,kBAAP,MAA+B,mCAA/B;;;AAEA,MAAMC,MAAM,GAAG,MAAM;AAAA;;AACnB,QAAM;AAAEC,IAAAA;AAAF,MAAgBN,WAAW,EAAjC;;AAEA,MAAI,CAACM,SAAD,IAAc,CAACA,SAAS,CAACC,eAA7B,EAA8C;AAC5C,WAAO,IAAP;AACD;;AAED,sBACE;AAAK,IAAA,SAAS,EAAC,QAAf;AAAA,2BACE;AAAK,MAAA,SAAS,EAAC,gBAAf;AAAA,8BACE;AAAK,QAAA,SAAS,EAAC,kCAAf;AAAA,gCACE,QAAC,IAAD;AAAA;AAAA;AAAA;AAAA,gBADF,eAEE,QAAC,QAAD;AAAA;AAAA;AAAA;AAAA,gBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,cADF,eAKE;AAAK,QAAA,SAAS,EAAC,6BAAf;AAAA,+BACE;AAAI,UAAA,SAAS,EAAC,uBAAd;AAAA,kCACE,QAAC,SAAD;AAAA;AAAA;AAAA;AAAA,kBADF,eAEE,QAAC,kBAAD;AAAA;AAAA;AAAA;AAAA,kBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,cALF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAgBD,CAvBD;;GAAMF,M;UACkBL,W;;;KADlBK,M;AAyBN,eAAeA,MAAf","sourcesContent":["import React from 'react'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport \"./Navbar.css\"\r\nimport Logo from './logo/Logo'\r\nimport NavLinks from './navLinks/NavLinks'\r\nimport Searchbar from './searchbar/Searchbar'\r\nimport NavbarDropdownMenu from './dropdownMenu/NavbarDropdownMenu'\r\n\r\nconst Navbar = () => {\r\n const { authState } = useOktaAuth();\r\n\r\n if (!authState || !authState.isAuthenticated) {\r\n return null;\r\n }\r\n\r\n return (\r\n <div className=\"navbar\" >\r\n <div className=\"header-content\">\r\n <div className=\"title-navigation-links-container\">\r\n <Logo />\r\n <NavLinks />\r\n </div>\r\n <div className=\"searchbar-profile-container\">\r\n <ul className=\"right-unstyled-navbar\">\r\n <Searchbar />\r\n <NavbarDropdownMenu />\r\n </ul>\r\n </div>\r\n </div>\r\n </div >\r\n )\r\n}\r\n\r\nexport default Navbar"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\updateUserData\\\\updateUserDataModal\\\\UpdateUserDataModal.js\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect } from 'react';\nimport \"./UpdateUserDataModal.css\";\nimport { useOktaAuth } from '@okta/okta-react';\nimport config from '../../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst UpdateUserDataModal = ({\n removeModal\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n const accessToken = oktaAuth.getAccessToken();\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 useEffect(() => {\n userInfo && setFirstname(userInfo.given_name);\n userInfo && setLastname(userInfo.family_name);\n userInfo && setUsername(userInfo.email);\n }, [userInfo]);\n const [firstname, setFirstname] = useState('');\n const [lastname, setLastname] = useState('');\n const [username, setUsername] = useState('');\n\n const handlefirstnameChange = e => {\n setFirstname(e.target.value);\n };\n\n const handlelastnameChange = e => {\n setLastname(e.target.value);\n };\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const userInputData = JSON.stringify({\n firstname: `${firstname}`,\n lastname: `${lastname}`,\n email: `${username}`\n });\n const updateUserDataRequestOptions = {\n method: 'PUT',\n headers: {\n Authorization: `Bearer ${accessToken}`\n },\n body: userInputData\n };\n\n const handleUpdateUserDataFormSubmit = e => {\n e.preventDefault();\n fetch(config.serviceAPI.updateUserDataURL, updateUserDataRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n removeModal();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"updateUserDataModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Update information\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 85,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n userDataSubmitForm: true,\n children: /*#__PURE__*/_jsxDEV(\"form\", {\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"First name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"firstname\",\n type: \"text\",\n value: firstname,\n onChange: handlefirstnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Last Name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"lastname\",\n type: \"text\",\n value: lastname,\n onChange: handlelastnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 97,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 104,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 102,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"Cancel\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 110,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n onClick: handleUpdateUserDataFormSubmit,\n children: \"Update\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 113,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 109,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 87,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 86,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 84,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 83,\n columnNumber: 5\n }, this);\n};\n\n_s(UpdateUserDataModal, \"AxzdzHC979Yq9E6/6HJDjeCl4CA=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = UpdateUserDataModal;\nexport default UpdateUserDataModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"UpdateUserDataModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/updateUserData/updateUserDataModal/UpdateUserDataModal.js"],"names":["React","useState","useEffect","useOktaAuth","config","UpdateUserDataModal","removeModal","authState","oktaAuth","userInfo","setUserInfo","accessToken","getAccessToken","isAuthenticated","getUser","then","info","setFirstname","given_name","setLastname","family_name","setUsername","email","firstname","lastname","username","handlefirstnameChange","e","target","value","handlelastnameChange","handleUsernameChange","userInputData","JSON","stringify","updateUserDataRequestOptions","method","headers","Authorization","body","handleUpdateUserDataFormSubmit","preventDefault","fetch","serviceAPI","updateUserDataURL","res","ok","window","alert","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,OAAO,2BAAP;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAOC,MAAP,MAAmB,iBAAnB;;;AAEA,MAAMC,mBAAmB,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAqB;AAAA;;AAC/C,QAAM;AAAEC,IAAA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AAA,QAAQ,EAAEG;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBADF,eAQE;AAAA,kDAEE;AACE,cAAA,EAAE,EAAC,UADL;AACgB,cAAA,IAAI,EAAC,MADrB;AAEE,cAAA,KAAK,EAAEF,QAFT;AAGE,cAAA,QAAQ,EAAEM;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBARF,eAeE;AAAA,8CAEE;AACE,cAAA,EAAE,EAAC,OADL;AACa,cAAA,IAAI,EAAC,MADlB;AAEE,cAAA,KAAK,EAAEL,QAFT;AAGE,cAAA,QAAQ,EAAEM;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF,eAsBE;AAAK,YAAA,SAAS,EAAC,iBAAf;AAAA,oCACE;AAAQ,cAAA,SAAS,EAAC,UAAlB;AAA6B,cAAA,OAAO,EAAEJ,CAAC,IAAIrB,WAAW,EAAtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBADF,eAIE;AAAQ,cAAA,SAAS,EAAC,WAAlB;AAA8B,cAAA,OAAO,EAAEkC,8BAAvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAJF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAtBF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,cAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAwCD,CApHD;;GAAMnC,mB;UAC4BF,W;;;KAD5BE,mB;AAsHN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useEffect } from 'react'\r\nimport \"./UpdateUserDataModal.css\"\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport config from '../../../config';\r\n\r\nconst UpdateUserDataModal = ({ removeModal }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n const accessToken = oktaAuth.getAccessToken();\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 useEffect(() => {\r\n userInfo && (\r\n setFirstname(userInfo.given_name)\r\n )\r\n\r\n userInfo && (\r\n setLastname(userInfo.family_name)\r\n )\r\n\r\n userInfo && (\r\n setUsername(userInfo.email)\r\n )\r\n }, [userInfo])\r\n\r\n const [firstname, setFirstname] = useState('')\r\n const [lastname, setLastname] = useState('')\r\n const [username, setUsername] = useState('');\r\n\r\n const handlefirstnameChange = (e) => {\r\n setFirstname(e.target.value)\r\n }\r\n\r\n const handlelastnameChange = (e) => {\r\n setLastname(e.target.value)\r\n }\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`\r\n })\r\n\r\n const updateUserDataRequestOptions = {\r\n method: 'PUT',\r\n headers: {\r\n Authorization: `Bearer ${accessToken}`,\r\n },\r\n body: userInputData\r\n };\r\n\r\n const handleUpdateUserDataFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n fetch(config.serviceAPI.updateUserDataURL, updateUserDataRequestOptions)\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 removeModal()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"updateUserDataModal\">\r\n <h2>Update information</h2>\r\n <div userDataSubmitForm>\r\n <form>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n Cancel\r\n </button>\r\n <button className=\"yesButton\" onClick={handleUpdateUserDataFormSubmit}>\r\n Update\r\n </button>\r\n </div>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default UpdateUserDataModal\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\\\\changePassword\\\\ChangePassword.js\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect } from 'react';\nimport { useOktaAuth } from '@okta/okta-react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport MessageModal from '../messageModal/MessageModal';\nimport config from '../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst ChangePassword = () => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const accessToken = oktaAuth.getAccessToken();\n const [submitOkMessageModalState, setSubmitOkMessageModalState] = useState(false);\n const [userInfo, setUserInfo] = useState(null);\n const [oldPassword, setOldPassword] = useState(null);\n const [newPassword, setNewPassword] = useState(null);\n const [confirmNewPassword, setConfirmNewPassword] = 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 const handleOldPasswordChange = e => {\n setOldPassword(e.target.value);\n };\n\n const handleNewPasswordChange = e => {\n setNewPassword(e.target.value);\n };\n\n const handleConfirmNewPasswordChange = e => {\n setConfirmNewPassword(e.target.value);\n };\n\n const userInputData = JSON.stringify({\n email: `${userInfo && userInfo.email}`,\n newPassword: `${newPassword}`\n });\n const ChangePasswordRequestOptions = {\n method: 'PUT',\n headers: {\n Authorization: `Bearer ${accessToken}`\n },\n body: userInputData\n };\n\n const handleChangePasswordFormSubmit = e => {\n e.preventDefault();\n\n if (!oldPassword || !newPassword || !confirmNewPassword) {\n window.alert(\"A password field is blank\");\n return;\n }\n\n if (!(confirmNewPassword.length >= 7)) {\n window.alert(\"Password must consist of 8 characters or more\");\n return;\n }\n\n if (!(newPassword === confirmNewPassword)) {\n window.alert(\"Passwords do not match\");\n return;\n } else {\n fetch(config.serviceAPI.changePasswordURL, ChangePasswordRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error: password requirements were not met\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n setSubmitOkMessageModalState(true);\n setOldPassword('');\n setNewPassword('');\n setConfirmNewPassword('');\n }\n });\n }\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"change-password-container\",\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"container-header\",\n children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"lock\",\n className: \"lock-icon\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 92,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"h5\", {\n children: \"Change password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 93,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 91,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"content\",\n children: [/*#__PURE__*/_jsxDEV(\"p\", {\n children: \"Password requirements:\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 96,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"ul\", {\n children: [/*#__PURE__*/_jsxDEV(\"li\", {\n children: \"Old password must be correct\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 98,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"li\", {\n children: \"New password must consist of at least 8 characters\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 101,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"li\", {\n children: \"No parts of username may be included in the new password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 104,\n columnNumber: 11\n }, this), /*#__PURE__*/_jsxDEV(\"li\", {\n children: \"Your new password cannot be any of your last 4 passwords\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 107,\n columnNumber: 11\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 97,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n onSubmit: handleChangePasswordFormSubmit,\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"reset-password-form-container\",\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"form-item\",\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: \"Old password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 114,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"oldPassword\",\n type: \"password\",\n value: oldPassword,\n onChange: handleOldPasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 117,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 113,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"form-item\",\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: \"New password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 123,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"newPassword\",\n type: \"password\",\n value: newPassword,\n onChange: handleNewPasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 126,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 122,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"form-item\",\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: \"Confirm new password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 132,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"confirmNewPassword\",\n type: \"password\",\n value: confirmNewPassword,\n onChange: handleConfirmNewPasswordChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 135,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 131,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"form-item\",\n children: /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"passwordResetSubmitButton\",\n type: \"submit\",\n children: [\"Submit\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"arrow-right\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 143,\n columnNumber: 17\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 141,\n columnNumber: 15\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 140,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 112,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 111,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: `modal ${submitOkMessageModalState ? \"active\" : \"inactive\"}`,\n children: /*#__PURE__*/_jsxDEV(MessageModal, {\n removeModal: () => setSubmitOkMessageModalState(false),\n headerMessage: \"Password has been changed\",\n bodyMessage: \"You can now sign in using your new password\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 150,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 149,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 5\n }, this);\n};\n\n_s(ChangePassword, \"Xnl+NTauGVDCVlSJN6leYUI37T8=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = ChangePassword;\nexport default ChangePassword;\n\nvar _c;\n\n$RefreshReg$(_c, \"ChangePassword\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/changePassword/ChangePassword.js"],"names":["React","useState","useEffect","useOktaAuth","FontAwesomeIcon","MessageModal","config","ChangePassword","authState","oktaAuth","accessToken","getAccessToken","submitOkMessageModalState","setSubmitOkMessageModalState","userInfo","setUserInfo","oldPassword","setOldPassword","newPassword","setNewPassword","confirmNewPassword","setConfirmNewPassword","isAuthenticated","getUser","then","info","handleOldPasswordChange","e","target","value","handleNewPasswordChange","handleConfirmNewPasswordChange","userInputData","JSON","stringify","email","ChangePasswordRequestOptions","method","headers","Authorization","body","handleChangePasswordFormSubmit","preventDefault","window","alert","length","fetch","serviceAPI","changePasswordURL","res","ok","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAOC,YAAP,MAAyB,8BAAzB;AACA,OAAOC,MAAP,MAAmB,cAAnB;;;AAEA,MAAMC,cAAc,GAAG,MAAM;AAAA;;AAC3B,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BN,WAAW,EAA3C;AACA,QAAMO,WAAW,GAAGD,QAAQ,CAACE,cAAT,EAApB;AACA,QAAM,CAACC,yBAAD,EAA4BC,4B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;AAAA;AAAA,oBADF,eAIE;AACE,cAAA,EAAE,EAAC,oBADL;AAC0B,cAAA,IAAI,EAAC,UAD/B;AAEE,cAAA,KAAK,EAAEV,kBAFT;AAGE,cAAA,QAAQ,EAAEW;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAJF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAnBF,eA4BE;AAAK,YAAA,SAAS,EAAC,WAAf;AAAA,mCACE;AAAQ,cAAA,SAAS,EAAC,2BAAlB;AAA8C,cAAA,IAAI,EAAC,QAAnD;AAAA,oDAEE,QAAC,eAAD;AAAiB,gBAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,sBAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,kBA5BF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,cAhBF;AAAA;AAAA;AAAA;AAAA;AAAA,YALF,eA2DE;AAAK,MAAA,SAAS,EAAG,SAAQnB,yBAAyB,GAAG,QAAH,GAAc,UAAW,EAA3E;AAAA,6BACE,QAAC,YAAD;AAAc,QAAA,WAAW,EAAE,MAAMC,4BAA4B,CAAC,KAAD,CAA7D;AAAsE,QAAA,aAAa,EAAE,2BAArF;AAAkH,QAAA,WAAW,EAAE;AAA/H;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YA3DF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAiED,CAnJD;;GAAMN,c;UAC4BJ,W;;;KAD5BI,c;AAqJN,eAAeA,cAAf","sourcesContent":["import React, { useState, useEffect } from 'react'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport MessageModal from '../messageModal/MessageModal'\r\nimport config from '../../config';\r\n\r\nconst ChangePassword = () => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const accessToken = oktaAuth.getAccessToken();\r\n const [submitOkMessageModalState, setSubmitOkMessageModalState] = useState(false);\r\n\r\n const [userInfo, setUserInfo] = useState(null);\r\n const [oldPassword, setOldPassword] = useState(null)\r\n const [newPassword, setNewPassword] = useState(null)\r\n const [confirmNewPassword, setConfirmNewPassword] = 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 const handleOldPasswordChange = (e) => {\r\n setOldPassword(e.target.value)\r\n }\r\n\r\n const handleNewPasswordChange = (e) => {\r\n setNewPassword(e.target.value)\r\n }\r\n\r\n const handleConfirmNewPasswordChange = (e) => {\r\n setConfirmNewPassword(e.target.value);\r\n }\r\n\r\n const userInputData = JSON.stringify({\r\n email: `${userInfo && userInfo.email}`,\r\n newPassword: `${newPassword}`\r\n })\r\n\r\n const ChangePasswordRequestOptions = {\r\n method: 'PUT',\r\n headers: {\r\n Authorization: `Bearer ${accessToken}`,\r\n },\r\n body: userInputData\r\n }\r\n\r\n const handleChangePasswordFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n if (!oldPassword || !newPassword || !confirmNewPassword) {\r\n window.alert(\"A password field is blank\")\r\n return\r\n }\r\n\r\n if (!(confirmNewPassword.length >= 7)) {\r\n window.alert(\"Password must consist of 8 characters or more\")\r\n return\r\n }\r\n\r\n if (!(newPassword === confirmNewPassword)) {\r\n window.alert(\"Passwords do not match\")\r\n return\r\n }\r\n\r\n else {\r\n fetch(config.serviceAPI.changePasswordURL, ChangePasswordRequestOptions)\r\n .then((res) => {\r\n if (!res.ok) {\r\n window.alert(\"Error: password requirements were not met\")\r\n Promise.reject(\"\")\r\n return\r\n }\r\n if (res.ok) {\r\n setSubmitOkMessageModalState(true)\r\n setOldPassword('')\r\n setNewPassword('')\r\n setConfirmNewPassword('')\r\n }\r\n })\r\n }\r\n }\r\n\r\n return (\r\n <div className=\"change-password-container\">\r\n <div className=\"container-header\">\r\n <FontAwesomeIcon icon=\"lock\" className=\"lock-icon\"></FontAwesomeIcon>\r\n <h5>Change password</h5>\r\n </div>\r\n <div className=\"content\">\r\n <p>Password requirements:</p>\r\n <ul>\r\n <li>\r\n Old password must be correct\r\n </li>\r\n <li>\r\n New password must consist of at least 8 characters\r\n </li>\r\n <li>\r\n No parts of username may be included in the new password\r\n </li>\r\n <li>\r\n Your new password cannot be any of your last 4 passwords\r\n </li>\r\n </ul>\r\n <form onSubmit={handleChangePasswordFormSubmit}>\r\n <div className=\"reset-password-form-container\">\r\n <div className=\"form-item\">\r\n <label>\r\n Old password\r\n </label>\r\n <input\r\n id=\"oldPassword\" type=\"password\"\r\n value={oldPassword}\r\n onChange={handleOldPasswordChange} />\r\n </div>\r\n <div className=\"form-item\">\r\n <label>\r\n New password\r\n </label>\r\n <input\r\n id=\"newPassword\" type=\"password\"\r\n value={newPassword}\r\n onChange={handleNewPasswordChange} />\r\n </div>\r\n <div className=\"form-item\">\r\n <label>\r\n Confirm new password\r\n </label>\r\n <input\r\n id=\"confirmNewPassword\" type=\"password\"\r\n value={confirmNewPassword}\r\n onChange={handleConfirmNewPasswordChange} />\r\n </div>\r\n <div className=\"form-item\">\r\n <button className=\"passwordResetSubmitButton\" type=\"submit\">\r\n Submit&nbsp;\r\n <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n <div className={`modal ${submitOkMessageModalState ? \"active\" : \"inactive\"}`}>\r\n <MessageModal removeModal={() => setSubmitOkMessageModalState(false)} headerMessage={\"Password has been changed\"} bodyMessage={\"You can now sign in using your new password\"} />\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default ChangePassword\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\\\\updateUserData\\\\updateUserDataModal\\\\UpdateUserDataModal.js\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect } from 'react';\nimport \"./UpdateUserDataModal.css\";\nimport { useOktaAuth } from '@okta/okta-react';\nimport config from '../../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst UpdateUserDataModal = ({\n removeModal\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n const accessToken = oktaAuth.getAccessToken();\n\n const stopProp = e => {\n e.preventDefault();\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 useEffect(() => {\n userInfo && setFirstname(userInfo.given_name);\n userInfo && setLastname(userInfo.family_name);\n userInfo && setUsername(userInfo.email);\n }, [userInfo]);\n const [firstname, setFirstname] = useState('');\n const [lastname, setLastname] = useState('');\n const [username, setUsername] = useState('');\n\n const handlefirstnameChange = e => {\n setFirstname(e.target.value);\n };\n\n const handlelastnameChange = e => {\n setLastname(e.target.value);\n };\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const userInputData = JSON.stringify({\n firstname: `${firstname}`,\n lastname: `${lastname}`,\n email: `${username}`\n });\n const updateUserDataRequestOptions = {\n method: 'PUT',\n headers: {\n Authorization: `Bearer ${accessToken}`\n },\n body: userInputData\n };\n\n const handleUpdateUserDataFormSubmit = e => {\n e.preventDefault();\n fetch(config.serviceAPI.updateUserDataURL, updateUserDataRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n removeModal();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"updateUserDataModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Update information\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n userDataSubmitForm: true,\n children: /*#__PURE__*/_jsxDEV(\"form\", {\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"First name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"firstname\",\n type: \"text\",\n value: firstname,\n onChange: handlefirstnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 93,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Last Name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"lastname\",\n type: \"text\",\n value: lastname,\n onChange: handlelastnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 102,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 100,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 109,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 107,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => stopProp,\n children: \"Cancel\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 115,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n onClick: handleUpdateUserDataFormSubmit,\n children: \"Update\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 118,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 114,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 92,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 91,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 5\n }, this);\n};\n\n_s(UpdateUserDataModal, \"AxzdzHC979Yq9E6/6HJDjeCl4CA=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = UpdateUserDataModal;\nexport default UpdateUserDataModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"UpdateUserDataModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/updateUserData/updateUserDataModal/UpdateUserDataModal.js"],"names":["React","useState","useEffect","useOktaAuth","config","UpdateUserDataModal","removeModal","authState","oktaAuth","userInfo","setUserInfo","accessToken","getAccessToken","stopProp","e","preventDefault","stopPropagation","isAuthenticated","getUser","then","info","setFirstname","given_name","setLastname","family_name","setUsername","email","firstname","lastname","username","handlefirstnameChange","target","value","handlelastnameChange","handleUsernameChange","userInputData","JSON","stringify","updateUserDataRequestOptions","method","headers","Authorization","body","handleUpdateUserDataFormSubmit","fetch","serviceAPI","updateUserDataURL","res","ok","window","alert","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,OAAO,2BAAP;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAOC,MAAP,MAAmB,iBAAnB;;;AAEA,MAAMC,mBAAmB,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAqB;AAAA;;AAC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nimport \"./UpdateUserDataModal.css\"\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport config from '../../../config';\r\n\r\nconst UpdateUserDataModal = ({ removeModal }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n const accessToken = oktaAuth.getAccessToken();\r\n\r\n const stopProp = e => {\r\n e.preventDefault()\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 useEffect(() => {\r\n userInfo && (\r\n setFirstname(userInfo.given_name)\r\n )\r\n\r\n userInfo && (\r\n setLastname(userInfo.family_name)\r\n )\r\n\r\n userInfo && (\r\n setUsername(userInfo.email)\r\n )\r\n }, [userInfo])\r\n\r\n const [firstname, setFirstname] = useState('')\r\n const [lastname, setLastname] = useState('')\r\n const [username, setUsername] = useState('');\r\n\r\n const handlefirstnameChange = (e) => {\r\n setFirstname(e.target.value)\r\n }\r\n\r\n const handlelastnameChange = (e) => {\r\n setLastname(e.target.value)\r\n }\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`\r\n })\r\n\r\n const updateUserDataRequestOptions = {\r\n method: 'PUT',\r\n headers: {\r\n Authorization: `Bearer ${accessToken}`,\r\n },\r\n body: userInputData\r\n };\r\n\r\n const handleUpdateUserDataFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n fetch(config.serviceAPI.updateUserDataURL, updateUserDataRequestOptions)\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 removeModal()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"updateUserDataModal\">\r\n <h2>Update information</h2>\r\n <div userDataSubmitForm>\r\n <form>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={e => stopProp}>\r\n Cancel\r\n </button>\r\n <button className=\"yesButton\" onClick={handleUpdateUserDataFormSubmit}>\r\n Update\r\n </button>\r\n </div>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default UpdateUserDataModal\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\\\\updateUserData\\\\updateUserDataModal\\\\UpdateUserDataModal.js\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect } from 'react';\nimport \"./UpdateUserDataModal.css\";\nimport { useOktaAuth } from '@okta/okta-react';\nimport config from '../../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst UpdateUserDataModal = ({\n removeModal\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n const accessToken = oktaAuth.getAccessToken();\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 useEffect(() => {\n userInfo && setFirstname(userInfo.given_name);\n userInfo && setLastname(userInfo.family_name);\n userInfo && setUsername(userInfo.email);\n }, [userInfo]);\n const [firstname, setFirstname] = useState('');\n const [lastname, setLastname] = useState('');\n const [username, setUsername] = useState('');\n\n const handlefirstnameChange = e => {\n setFirstname(e.target.value);\n };\n\n const handlelastnameChange = e => {\n setLastname(e.target.value);\n };\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const userInputData = JSON.stringify({\n firstname: `${firstname}`,\n lastname: `${lastname}`,\n email: `${username}`\n });\n const updateUserDataRequestOptions = {\n method: 'PUT',\n headers: {\n Authorization: `Bearer ${accessToken}`\n },\n body: userInputData\n };\n\n const handleUpdateUserDataFormSubmit = e => {\n e.preventDefault();\n fetch(config.serviceAPI.updateUserDataURL, updateUserDataRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n removeModal();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"updateUserDataModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Update information\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n userDataSubmitForm: true,\n children: /*#__PURE__*/_jsxDEV(\"form\", {\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"First name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"firstname\",\n type: \"text\",\n value: firstname,\n onChange: handlefirstnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 94,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 92,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Last Name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"lastname\",\n type: \"text\",\n value: lastname,\n onChange: handlelastnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 101,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 99,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 108,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 106,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => removeModal(),\n children: \"Cancel\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 114,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n onClick: handleUpdateUserDataFormSubmit,\n children: \"Update\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 117,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 113,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 91,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 87,\n columnNumber: 5\n }, this);\n};\n\n_s(UpdateUserDataModal, \"AxzdzHC979Yq9E6/6HJDjeCl4CA=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = UpdateUserDataModal;\nexport default UpdateUserDataModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"UpdateUserDataModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/updateUserData/updateUserDataModal/UpdateUserDataModal.js"],"names":["React","useState","useEffect","useOktaAuth","config","UpdateUserDataModal","removeModal","authState","oktaAuth","userInfo","setUserInfo","accessToken","getAccessToken","stopProp","e","stopPropagation","isAuthenticated","getUser","then","info","setFirstname","given_name","setLastname","family_name","setUsername","email","firstname","lastname","username","handlefirstnameChange","target","value","handlelastnameChange","handleUsernameChange","userInputData","JSON","stringify","updateUserDataRequestOptions","method","headers","Authorization","body","handleUpdateUserDataFormSubmit","preventDefault","fetch","serviceAPI","updateUserDataURL","res","ok","window","alert","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,OAAO,2BAAP;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAOC,MAAP,MAAmB,iBAAnB;;;AAEA,MAAMC,mBAAmB,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAqB;AAAA;;AAC/C,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BL,WAAW,EAA3C;AACA,QAAM,CAACM,QAAD,EAAWC,WAAX,IAA0BT,QAAQ,CAAC,IAAD,CAAxC;AACA,QAAMU,WAAW,GAAGH,QAAQ,CAACI,cAAT,EAApB;;AAEA,QAAMC,QAAQ,GAAGC,CAAC,IAAI;AACpBA,IAAAA,CAAC,CAACC,eAAF;AACD,GAFD;;AAIAb,EAAAA,SAAS,CAAC,MAAM;AACd,QAAI,CAACK,SAAS,CAACS,eAAf,EAAgC;AAC9B;AACAN,MAAAA,WAAW,CAAC,IAAD,CAAX;AACD,KAHD,MAGO;AACLF,MAAAA,QAAQ,CAACS,OAAT,GAAmBC,IAAnB,CAAwBC,IAAI,IAAI;AAC9BT,QAAAA,WAAW,CAACS,IAAD,CAAX;AACD,OAFD;AAGD;AACF,GATQ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Q,EAAEK;AAHZ;AAAA;AAAA;AAAA;AAAA,oBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAfF,eAsBE;AAAK,YAAA,SAAS,EAAC,iBAAf;AAAA,oCACE;AAAQ,cAAA,SAAS,EAAC,UAAlB;AAA6B,cAAA,OAAO,EAAEnB,CAAC,IAAIR,WAAW,EAAtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBADF,eAIE;AAAQ,cAAA,SAAS,EAAC,WAAlB;AAA8B,cAAA,OAAO,EAAEoC,8BAAvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAJF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAtBF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,cAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAwCD,CAxHD;;GAAMrC,mB;UAC4BF,W;;;KAD5BE,mB;AA0HN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useEffect } from 'react'\r\nimport \"./UpdateUserDataModal.css\"\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport config from '../../../config';\r\n\r\nconst UpdateUserDataModal = ({ removeModal }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n const accessToken = oktaAuth.getAccessToken();\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 useEffect(() => {\r\n userInfo && (\r\n setFirstname(userInfo.given_name)\r\n )\r\n\r\n userInfo && (\r\n setLastname(userInfo.family_name)\r\n )\r\n\r\n userInfo && (\r\n setUsername(userInfo.email)\r\n )\r\n }, [userInfo])\r\n\r\n const [firstname, setFirstname] = useState('')\r\n const [lastname, setLastname] = useState('')\r\n const [username, setUsername] = useState('');\r\n\r\n const handlefirstnameChange = (e) => {\r\n setFirstname(e.target.value)\r\n }\r\n\r\n const handlelastnameChange = (e) => {\r\n setLastname(e.target.value)\r\n }\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`\r\n })\r\n\r\n const updateUserDataRequestOptions = {\r\n method: 'PUT',\r\n headers: {\r\n Authorization: `Bearer ${accessToken}`,\r\n },\r\n body: userInputData\r\n };\r\n\r\n const handleUpdateUserDataFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n fetch(config.serviceAPI.updateUserDataURL, updateUserDataRequestOptions)\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 removeModal()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"updateUserDataModal\">\r\n <h2>Update information</h2>\r\n <div userDataSubmitForm>\r\n <form>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={e => removeModal()}>\r\n Cancel\r\n </button>\r\n <button className=\"yesButton\" onClick={handleUpdateUserDataFormSubmit}>\r\n Update\r\n </button>\r\n </div>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default UpdateUserDataModal\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\\\\updateUserData\\\\updateUserDataModal\\\\UpdateUserDataModal.js\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect } from 'react';\nimport \"./UpdateUserDataModal.css\";\nimport { useOktaAuth } from '@okta/okta-react';\nimport config from '../../../config';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst UpdateUserDataModal = ({\n removeModal\n}) => {\n _s();\n\n const {\n authState,\n oktaAuth\n } = useOktaAuth();\n const [userInfo, setUserInfo] = useState(null);\n const accessToken = oktaAuth.getAccessToken();\n\n const stopProp = e => {\n e.preventDefault(); // 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 useEffect(() => {\n userInfo && setFirstname(userInfo.given_name);\n userInfo && setLastname(userInfo.family_name);\n userInfo && setUsername(userInfo.email);\n }, [userInfo]);\n const [firstname, setFirstname] = useState('');\n const [lastname, setLastname] = useState('');\n const [username, setUsername] = useState('');\n\n const handlefirstnameChange = e => {\n setFirstname(e.target.value);\n };\n\n const handlelastnameChange = e => {\n setLastname(e.target.value);\n };\n\n const handleUsernameChange = e => {\n setUsername(e.target.value);\n };\n\n const userInputData = JSON.stringify({\n firstname: `${firstname}`,\n lastname: `${lastname}`,\n email: `${username}`\n });\n const updateUserDataRequestOptions = {\n method: 'PUT',\n headers: {\n Authorization: `Bearer ${accessToken}`\n },\n body: userInputData\n };\n\n const handleUpdateUserDataFormSubmit = e => {\n e.preventDefault();\n fetch(config.serviceAPI.updateUserDataURL, updateUserDataRequestOptions).then(res => {\n if (!res.ok) {\n window.alert(\"Error\");\n Promise.reject(\"\");\n return;\n }\n\n if (res.ok) {\n removeModal();\n }\n });\n };\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"modal-content\",\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"updateUserDataModal\",\n children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n children: \"Update information\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 90,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n userDataSubmitForm: true,\n children: /*#__PURE__*/_jsxDEV(\"form\", {\n children: [/*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"First name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"firstname\",\n type: \"text\",\n value: firstname,\n onChange: handlefirstnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 93,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Last Name:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"lastname\",\n type: \"text\",\n value: lastname,\n onChange: handlelastnameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 102,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 100,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"label\", {\n children: [\"Email:\", /*#__PURE__*/_jsxDEV(\"input\", {\n id: \"email\",\n type: \"text\",\n value: username,\n onChange: handleUsernameChange\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 109,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 107,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"buttonContainer\",\n children: [/*#__PURE__*/_jsxDEV(\"button\", {\n className: \"noButton\",\n onClick: e => stopProp,\n children: \"Cancel\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 115,\n columnNumber: 15\n }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n className: \"yesButton\",\n onClick: handleUpdateUserDataFormSubmit,\n children: \"Update\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 118,\n columnNumber: 15\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 114,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 92,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 91,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 89,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 88,\n columnNumber: 5\n }, this);\n};\n\n_s(UpdateUserDataModal, \"AxzdzHC979Yq9E6/6HJDjeCl4CA=\", false, function () {\n return [useOktaAuth];\n});\n\n_c = UpdateUserDataModal;\nexport default UpdateUserDataModal;\n\nvar _c;\n\n$RefreshReg$(_c, \"UpdateUserDataModal\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/updateUserData/updateUserDataModal/UpdateUserDataModal.js"],"names":["React","useState","useEffect","useOktaAuth","config","UpdateUserDataModal","removeModal","authState","oktaAuth","userInfo","setUserInfo","accessToken","getAccessToken","stopProp","e","preventDefault","isAuthenticated","getUser","then","info","setFirstname","given_name","setLastname","family_name","setUsername","email","firstname","lastname","username","handlefirstnameChange","target","value","handlelastnameChange","handleUsernameChange","userInputData","JSON","stringify","updateUserDataRequestOptions","method","headers","Authorization","body","handleUpdateUserDataFormSubmit","fetch","serviceAPI","updateUserDataURL","res","ok","window","alert","Promise","reject"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,OAAO,2BAAP;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAOC,MA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UAC4BF,W;;;KAD5BE,mB;AA2HN,eAAeA,mBAAf","sourcesContent":["import React, { useState, useEffect } from 'react'\r\nimport \"./UpdateUserDataModal.css\"\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport config from '../../../config';\r\n\r\nconst UpdateUserDataModal = ({ removeModal }) => {\r\n const { authState, oktaAuth } = useOktaAuth();\r\n const [userInfo, setUserInfo] = useState(null);\r\n const accessToken = oktaAuth.getAccessToken();\r\n\r\n const stopProp = e => {\r\n e.preventDefault()\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 useEffect(() => {\r\n userInfo && (\r\n setFirstname(userInfo.given_name)\r\n )\r\n\r\n userInfo && (\r\n setLastname(userInfo.family_name)\r\n )\r\n\r\n userInfo && (\r\n setUsername(userInfo.email)\r\n )\r\n }, [userInfo])\r\n\r\n const [firstname, setFirstname] = useState('')\r\n const [lastname, setLastname] = useState('')\r\n const [username, setUsername] = useState('');\r\n\r\n const handlefirstnameChange = (e) => {\r\n setFirstname(e.target.value)\r\n }\r\n\r\n const handlelastnameChange = (e) => {\r\n setLastname(e.target.value)\r\n }\r\n\r\n const handleUsernameChange = (e) => {\r\n setUsername(e.target.value);\r\n };\r\n\r\n const userInputData = JSON.stringify({\r\n firstname: `${firstname}`,\r\n lastname: `${lastname}`,\r\n email: `${username}`\r\n })\r\n\r\n const updateUserDataRequestOptions = {\r\n method: 'PUT',\r\n headers: {\r\n Authorization: `Bearer ${accessToken}`,\r\n },\r\n body: userInputData\r\n };\r\n\r\n const handleUpdateUserDataFormSubmit = (e) => {\r\n e.preventDefault();\r\n\r\n fetch(config.serviceAPI.updateUserDataURL, updateUserDataRequestOptions)\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 removeModal()\r\n }\r\n })\r\n }\r\n\r\n return (\r\n <div className=\"modal-content\">\r\n <div className=\"updateUserDataModal\">\r\n <h2>Update information</h2>\r\n <div userDataSubmitForm>\r\n <form>\r\n <label>\r\n First name:\r\n <input\r\n id=\"firstname\" type=\"text\"\r\n value={firstname}\r\n onChange={handlefirstnameChange} />\r\n </label>\r\n <label>\r\n Last Name:\r\n <input\r\n id=\"lastname\" type=\"text\"\r\n value={lastname}\r\n onChange={handlelastnameChange} />\r\n </label>\r\n <label>\r\n Email:\r\n <input\r\n id=\"email\" type=\"text\"\r\n value={username}\r\n onChange={handleUsernameChange} />\r\n </label>\r\n <div className=\"buttonContainer\">\r\n <button className=\"noButton\" onClick={e => stopProp}>\r\n Cancel\r\n </button>\r\n <button className=\"yesButton\" onClick={handleUpdateUserDataFormSubmit}>\r\n Update\r\n </button>\r\n </div>\r\n </form>\r\n </div>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\nexport default UpdateUserDataModal\r\n"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
......@@ -63,7 +63,7 @@ const ChangePassword = () => {
return
}
if (!(newPassword == confirmNewPassword)) {
if (!(newPassword === confirmNewPassword)) {
window.alert("Passwords do not match")
return
}
......
import React from 'react'
const MessageModal = ({ removeModal, headerMessage, bodyMessage }) => {
const stopProp = e => {
e.stopPropagation()
}
return (
<div className="modal-content">
......
......@@ -7,7 +7,7 @@ import Searchbar from './searchbar/Searchbar'
import NavbarDropdownMenu from './dropdownMenu/NavbarDropdownMenu'
const Navbar = () => {
const { authState, oktaAuth } = useOktaAuth();
const { authState } = useOktaAuth();
if (!authState || !authState.isAuthenticated) {
return null;
......
......@@ -8,10 +8,6 @@ const UpdateUserDataModal = ({ removeModal }) => {
const [userInfo, setUserInfo] = useState(null);
const accessToken = oktaAuth.getAccessToken();
const stopProp = e => {
e.stopPropagation()
}
useEffect(() => {
if (!authState.isAuthenticated) {
// When user isn't authenticated, forget any user info
......@@ -88,7 +84,7 @@ const UpdateUserDataModal = ({ removeModal }) => {
<div className="updateUserDataModal">
<h2>Update information</h2>
<div userDataSubmitForm>
<form onSubmit={handleUpdateUserDataFormSubmit}>
<form>
<label>
First name:
<input
......@@ -114,7 +110,7 @@ const UpdateUserDataModal = ({ removeModal }) => {
<button className="noButton" onClick={e => removeModal()}>
Cancel
</button>
<button className="yesButton" type="submit">
<button className="yesButton" onClick={handleUpdateUserDataFormSubmit}>
Update
</button>
</div>
......
package main
import (
"net/http"
"log"
"github.com/gorilla/mux"
"net/http"
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
oktaUtils "github.com/okta/samples-golang/resource-server/utils"
......@@ -27,8 +28,6 @@ func main() {
router.HandleFunc("/api/update-user-data", service.Authenticate(service.UpdateUserData())).Methods("PUT")
router.HandleFunc("/api/change-password", service.Authenticate(service.ChangeUserPassword())).Methods("PUT")
// Setup cors
originsOK := handlers.AllowedOrigins([]string{"http://localhost:3000"})
headersOk := handlers.AllowedHeaders([]string{"Authorization"})
......@@ -37,4 +36,4 @@ func main() {
// Start server and listen for requests
log.Print("server starting at localhost:3030 ... ")
log.Fatal(http.ListenAndServe("localhost:3030", handlers.CORS(originsOK, headersOk, methodsOk)(router)))
}
\ 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