Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mathias Engelbrecht Pilegård
Pipit
Commits
0ba88032
Commit
0ba88032
authored
Aug 24, 2021
by
Mathias Engelbrecht Pilegård
Browse files
added ability to remove users through post requests
parent
b697b700
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
client/node_modules/.cache/.eslintcache
View file @
0ba88032
This diff is collapsed.
Click to expand it.
client/node_modules/.cache/babel-loader/138b784b17592de2b773ffb74d07a670.json
0 → 100644
View file @
0ba88032
{
"ast"
:
null
,
"code"
:
"var _jsxFileName =
\"
C:
\\\\
Users
\\\\
Bruger
\\\\
Desktop
\\\\
Web-projects
\\\\
pipit
\\\\
client
\\\\
src
\\\\
components
\\\\
home
\\\\
Home.jsx
\"
,
\n
_s = $RefreshSig$();
\n\n
import React, { useState, useEffect } from 'react';
\n
import { NavLink } from 'react-router-dom';
\n
import { useOktaAuth } from '@okta/okta-react';
\n
import
\"
./Home.css
\"
;
\n
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
\n
import Updates from './updates/Updates';
\n
import { jsxDEV as _jsxDEV } from
\"
react/jsx-dev-runtime
\"
;
\n\n
const Home = () => {
\n
_s();
\n\n
const {
\n
authState,
\n
oktaAuth
\n
} = useOktaAuth();
\n
const [userInfo, setUserInfo] = useState(null);
\n
useEffect(() => {
\n
if (!authState.isAuthenticated) {
\n
// When user isn't authenticated, forget any user info
\n
setUserInfo(null);
\n
} else {
\n
oktaAuth.getUser().then(info => {
\n
setUserInfo(info);
\n
});
\n
}
\n
}, [authState, oktaAuth]); // Update if authState changes
\n\n
return /*#__PURE__*/_jsxDEV(
\"
div
\"
, {
\n
className:
\"
page-content-container
\"
,
\n
children: [/*#__PURE__*/_jsxDEV(
\"
div
\"
, {
\n
className:
\"
content-header
\"
,
\n
children: [/*#__PURE__*/_jsxDEV(
\"
h2
\"
, {
\n
className:
\"
welcome-text
\"
,
\n
children: [
\"
Welcome
\"
, userInfo ? userInfo.Id :
\"
...
\"
,
\"
!
\"
]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 26,
\n
columnNumber: 9
\n
}, this), /*#__PURE__*/_jsxDEV(NavLink, {
\n
to:
\"
/reportissue
\"
,
\n
children: /*#__PURE__*/_jsxDEV(
\"
button
\"
, {
\n
className:
\"
report-new-issue-button
\"
,
\n
children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {
\n
icon:
\"
exclamation-triangle
\"\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 29,
\n
columnNumber: 13
\n
}, this),
\"\\
xA0
\\
xA0Report issues
\"
]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 28,
\n
columnNumber: 11
\n
}, this)
\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 27,
\n
columnNumber: 9
\n
}, this)]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 25,
\n
columnNumber: 7
\n
}, this), /*#__PURE__*/_jsxDEV(
\"
div
\"
, {
\n
className:
\"
homepage-content
\"
,
\n
children: /*#__PURE__*/_jsxDEV(Updates, {}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 35,
\n
columnNumber: 9
\n
}, this)
\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 34,
\n
columnNumber: 7
\n
}, this)]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 24,
\n
columnNumber: 5
\n
}, this);
\n
};
\n\n
_s(Home,
\"
/7FunoA1ejJNU8uKGTy1GZFqU2I=
\"
, false, function () {
\n
return [useOktaAuth];
\n
});
\n\n
_c = Home;
\n
export default Home;
\n\n
var _c;
\n\n
$RefreshReg$(_c,
\"
Home
\"
);"
,
"map"
:{
"version"
:
3
,
"sources"
:[
"C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/home/Home.jsx"
],
"names"
:[
"React"
,
"useState"
,
"useEffect"
,
"NavLink"
,
"useOktaAuth"
,
"FontAwesomeIcon"
,
"Updates"
,
"Home"
,
"authState"
,
"oktaAuth"
,
"userInfo"
,
"setUserInfo"
,
"isAuthenticated"
,
"getUser"
,
"then"
,
"info"
,
"Id"
],
"mappings"
:
";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,YAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAOC,OAAP,MAAoB,mBAApB;;;AAEA,MAAMC,IAAI,GAAG,MAAM;AAAA;;AACjB,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BL,WAAW,EAA3C;AACA,QAAM,CAACM,QAAD,EAAWC,WAAX,IAA0BV,QAAQ,CAAC,IAAD,CAAxC;AAEAC,EAAAA,SAAS,CAAC,MAAM;AACd,QAAI,CAACM,SAAS,CAACI,eAAf,EAAgC;AAC9B;AACAD,MAAAA,WAAW,CAAC,IAAD,CAAX;AACD,KAHD,MAGO;AACLF,MAAAA,QAAQ,CAACI,OAAT,GAAmBC,IAAnB,CAAwBC,IAAI,IAAI;AAC9BJ,QAAAA,WAAW,CAACI,IAAD,CAAX;AACD,OAFD;AAGD;AACF,GATQ,EASN,CAACP,SAAD,EAAYC,QAAZ,CATM,CAAT,CAJiB,CAaU;;AAE3B,sBACE;AAAK,IAAA,SAAS,EAAC,wBAAf;AAAA,4BACE;AAAK,MAAA,SAAS,EAAC,gBAAf;AAAA,8BACE;AAAI,QAAA,SAAS,EAAC,cAAd;AAAA,+BAAsCC,QAAQ,GAAGA,QAAQ,CAACM,EAAZ,GAAiB,KAA/D;AAAA;AAAA;AAAA;AAAA;AAAA,cADF,eAEE,QAAC,OAAD;AAAS,QAAA,EAAE,EAAC,cAAZ;AAAA,+BACE;AAAQ,UAAA,SAAS,EAAC,yBAAlB;AAAA,kCACE,QAAC,eAAD;AAAiB,YAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,kBADF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,cAFF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF,eAUE;AAAK,MAAA,SAAS,EAAC,kBAAf;AAAA,6BACE,QAAC,OAAD;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YAVF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAgBD,CA/BD;;GAAMT,I;UAC4BH,W;;;KAD5BG,I;AAiCN,eAAeA,IAAf"
,
"sourcesContent"
:[
"import React, { useState, useEffect } from 'react'
\r\n
import { NavLink } from 'react-router-dom'
\r\n
import { useOktaAuth } from '@okta/okta-react';
\r\n
import
\"
./Home.css
\"\r\n
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
\r\n
import Updates from './updates/Updates'
\r\n\r\n
const Home = () => {
\r\n
const { authState, oktaAuth } = useOktaAuth();
\r\n
const [userInfo, setUserInfo] = useState(null);
\r\n\r\n
useEffect(() => {
\r\n
if (!authState.isAuthenticated) {
\r\n
// When user isn't authenticated, forget any user info
\r\n
setUserInfo(null);
\r\n
} else {
\r\n
oktaAuth.getUser().then(info => {
\r\n
setUserInfo(info);
\r\n
});
\r\n
}
\r\n
}, [authState, oktaAuth]); // Update if authState changes
\r\n\r\n
return (
\r\n
<div className=
\"
page-content-container
\"
>
\r\n
<div className=
\"
content-header
\"
>
\r\n
<h2 className=
\"
welcome-text
\"
>Welcome {userInfo ? userInfo.Id :
\"
...
\"
}!</h2>
\r\n
<NavLink to=
\"
/reportissue
\"
>
\r\n
<button className=
\"
report-new-issue-button
\"
>
\r\n
<FontAwesomeIcon icon=
\"
exclamation-triangle
\"
></FontAwesomeIcon>
\r\n
Report issues
\r\n
</button>
\r\n
</NavLink>
\r\n
</div>
\r\n
<div className=
\"
homepage-content
\"
>
\r\n
<Updates />
\r\n
</div>
\r\n
</div>
\r\n
)
\r\n
}
\r\n\r\n
export default Home"
]},
"metadata"
:{},
"sourceType"
:
"module"
}
\ No newline at end of file
client/node_modules/.cache/babel-loader/483d24693e5aa0f18f9a930830050b5e.json
0 → 100644
View file @
0ba88032
{
"ast"
:
null
,
"code"
:
"var _jsxFileName =
\"
C:
\\\\
Users
\\\\
Bruger
\\\\
Desktop
\\\\
Web-projects
\\\\
pipit
\\\\
client
\\\\
src
\\\\
components
\\\\
home
\\\\
Home.jsx
\"
,
\n
_s = $RefreshSig$();
\n\n
import React, { useState, useEffect } from 'react';
\n
import { NavLink } from 'react-router-dom';
\n
import { useOktaAuth } from '@okta/okta-react';
\n
import
\"
./Home.css
\"
;
\n
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
\n
import Updates from './updates/Updates';
\n
import { jsxDEV as _jsxDEV } from
\"
react/jsx-dev-runtime
\"
;
\n\n
const Home = () => {
\n
_s();
\n\n
const {
\n
authState,
\n
oktaAuth
\n
} = useOktaAuth();
\n
const [userInfo, setUserInfo] = useState(null);
\n
useEffect(() => {
\n
if (!authState.isAuthenticated) {
\n
// When user isn't authenticated, forget any user info
\n
setUserInfo(null);
\n
} else {
\n
oktaAuth.getUser().then(info => {
\n
setUserInfo(info);
\n
});
\n
}
\n
}, [authState, oktaAuth]); // Update if authState changes
\n\n
return /*#__PURE__*/_jsxDEV(
\"
div
\"
, {
\n
className:
\"
page-content-container
\"
,
\n
children: [/*#__PURE__*/_jsxDEV(
\"
div
\"
, {
\n
className:
\"
content-header
\"
,
\n
children: [/*#__PURE__*/_jsxDEV(
\"
h2
\"
, {
\n
className:
\"
welcome-text
\"
,
\n
children: [
\"
Welcome
\"
, userInfo ? userInfo.password :
\"
...
\"
,
\"
!
\"
]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 26,
\n
columnNumber: 9
\n
}, this), /*#__PURE__*/_jsxDEV(NavLink, {
\n
to:
\"
/reportissue
\"
,
\n
children: /*#__PURE__*/_jsxDEV(
\"
button
\"
, {
\n
className:
\"
report-new-issue-button
\"
,
\n
children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {
\n
icon:
\"
exclamation-triangle
\"\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 29,
\n
columnNumber: 13
\n
}, this),
\"\\
xA0
\\
xA0Report issues
\"
]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 28,
\n
columnNumber: 11
\n
}, this)
\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 27,
\n
columnNumber: 9
\n
}, this)]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 25,
\n
columnNumber: 7
\n
}, this), /*#__PURE__*/_jsxDEV(
\"
div
\"
, {
\n
className:
\"
homepage-content
\"
,
\n
children: /*#__PURE__*/_jsxDEV(Updates, {}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 35,
\n
columnNumber: 9
\n
}, this)
\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 34,
\n
columnNumber: 7
\n
}, this)]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 24,
\n
columnNumber: 5
\n
}, this);
\n
};
\n\n
_s(Home,
\"
/7FunoA1ejJNU8uKGTy1GZFqU2I=
\"
, false, function () {
\n
return [useOktaAuth];
\n
});
\n\n
_c = Home;
\n
export default Home;
\n\n
var _c;
\n\n
$RefreshReg$(_c,
\"
Home
\"
);"
,
"map"
:{
"version"
:
3
,
"sources"
:[
"C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/home/Home.jsx"
],
"names"
:[
"React"
,
"useState"
,
"useEffect"
,
"NavLink"
,
"useOktaAuth"
,
"FontAwesomeIcon"
,
"Updates"
,
"Home"
,
"authState"
,
"oktaAuth"
,
"userInfo"
,
"setUserInfo"
,
"isAuthenticated"
,
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AA;AAAA,cAFF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF,eAUE;AAAK,MAAA,SAAS,EAAC,kBAAf;AAAA,6BACE,QAAC,OAAD;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YAVF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAgBD,CA/BD;;GAAMT,I;UAC4BH,W;;;KAD5BG,I;AAiCN,eAAeA,IAAf"
,
"sourcesContent"
:[
"import React, { useState, useEffect } from 'react'
\r\n
import { NavLink } from 'react-router-dom'
\r\n
import { useOktaAuth } from '@okta/okta-react';
\r\n
import
\"
./Home.css
\"\r\n
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
\r\n
import Updates from './updates/Updates'
\r\n\r\n
const Home = () => {
\r\n
const { authState, oktaAuth } = useOktaAuth();
\r\n
const [userInfo, setUserInfo] = useState(null);
\r\n\r\n
useEffect(() => {
\r\n
if (!authState.isAuthenticated) {
\r\n
// When user isn't authenticated, forget any user info
\r\n
setUserInfo(null);
\r\n
} else {
\r\n
oktaAuth.getUser().then(info => {
\r\n
setUserInfo(info);
\r\n
});
\r\n
}
\r\n
}, [authState, oktaAuth]); // Update if authState changes
\r\n\r\n
return (
\r\n
<div className=
\"
page-content-container
\"
>
\r\n
<div className=
\"
content-header
\"
>
\r\n
<h2 className=
\"
welcome-text
\"
>Welcome {userInfo ? userInfo.password :
\"
...
\"
}!</h2>
\r\n
<NavLink to=
\"
/reportissue
\"
>
\r\n
<button className=
\"
report-new-issue-button
\"
>
\r\n
<FontAwesomeIcon icon=
\"
exclamation-triangle
\"
></FontAwesomeIcon>
\r\n
Report issues
\r\n
</button>
\r\n
</NavLink>
\r\n
</div>
\r\n
<div className=
\"
homepage-content
\"
>
\r\n
<Updates />
\r\n
</div>
\r\n
</div>
\r\n
)
\r\n
}
\r\n\r\n
export default Home"
]},
"metadata"
:{},
"sourceType"
:
"module"
}
\ No newline at end of file
client/node_modules/.cache/babel-loader/d0af76ec773306c80aa467df9aaced38.json
0 → 100644
View file @
0ba88032
{
"ast"
:
null
,
"code"
:
"var _jsxFileName =
\"
C:
\\\\
Users
\\\\
Bruger
\\\\
Desktop
\\\\
Web-projects
\\\\
pipit
\\\\
client
\\\\
src
\\\\
components
\\\\
home
\\\\
Home.jsx
\"
,
\n
_s = $RefreshSig$();
\n\n
import React, { useState, useEffect } from 'react';
\n
import { NavLink } from 'react-router-dom';
\n
import { useOktaAuth } from '@okta/okta-react';
\n
import
\"
./Home.css
\"
;
\n
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
\n
import Updates from './updates/Updates';
\n
import { jsxDEV as _jsxDEV } from
\"
react/jsx-dev-runtime
\"
;
\n\n
const Home = () => {
\n
_s();
\n\n
const {
\n
authState,
\n
oktaAuth
\n
} = useOktaAuth();
\n
const [userInfo, setUserInfo] = useState(null);
\n
useEffect(() => {
\n
if (!authState.isAuthenticated) {
\n
// When user isn't authenticated, forget any user info
\n
setUserInfo(null);
\n
} else {
\n
oktaAuth.getUser().then(info => {
\n
setUserInfo(info);
\n
});
\n
}
\n
}, [authState, oktaAuth]); // Update if authState changes
\n\n
return /*#__PURE__*/_jsxDEV(
\"
div
\"
, {
\n
className:
\"
page-content-container
\"
,
\n
children: [/*#__PURE__*/_jsxDEV(
\"
div
\"
, {
\n
className:
\"
content-header
\"
,
\n
children: [/*#__PURE__*/_jsxDEV(
\"
h2
\"
, {
\n
className:
\"
welcome-text
\"
,
\n
children: [
\"
Welcome
\"
, userInfo ? userInfo.id :
\"
...
\"
,
\"
!
\"
]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 26,
\n
columnNumber: 9
\n
}, this), /*#__PURE__*/_jsxDEV(NavLink, {
\n
to:
\"
/reportissue
\"
,
\n
children: /*#__PURE__*/_jsxDEV(
\"
button
\"
, {
\n
className:
\"
report-new-issue-button
\"
,
\n
children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {
\n
icon:
\"
exclamation-triangle
\"\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 29,
\n
columnNumber: 13
\n
}, this),
\"\\
xA0
\\
xA0Report issues
\"
]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 28,
\n
columnNumber: 11
\n
}, this)
\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 27,
\n
columnNumber: 9
\n
}, this)]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 25,
\n
columnNumber: 7
\n
}, this), /*#__PURE__*/_jsxDEV(
\"
div
\"
, {
\n
className:
\"
homepage-content
\"
,
\n
children: /*#__PURE__*/_jsxDEV(Updates, {}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 35,
\n
columnNumber: 9
\n
}, this)
\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 34,
\n
columnNumber: 7
\n
}, this)]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 24,
\n
columnNumber: 5
\n
}, this);
\n
};
\n\n
_s(Home,
\"
/7FunoA1ejJNU8uKGTy1GZFqU2I=
\"
, false, function () {
\n
return [useOktaAuth];
\n
});
\n\n
_c = Home;
\n
export default Home;
\n\n
var _c;
\n\n
$RefreshReg$(_c,
\"
Home
\"
);"
,
"map"
:{
"version"
:
3
,
"sources"
:[
"C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/home/Home.jsx"
],
"names"
:[
"React"
,
"useState"
,
"useEffect"
,
"NavLink"
,
"useOktaAuth"
,
"FontAwesomeIcon"
,
"Updates"
,
"Home"
,
"authState"
,
"oktaAuth"
,
"userInfo"
,
"setUserInfo"
,
"isAuthenticated"
,
"getUser"
,
"then"
,
"info"
,
"id"
],
"mappings"
:
";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,O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AA;AAAA;AAAA;AAAA,UADF;AAgBD,CA/BD;;GAAMT,I;UAC4BH,W;;;KAD5BG,I;AAiCN,eAAeA,IAAf"
,
"sourcesContent"
:[
"import React, { useState, useEffect } from 'react'
\r\n
import { NavLink } from 'react-router-dom'
\r\n
import { useOktaAuth } from '@okta/okta-react';
\r\n
import
\"
./Home.css
\"\r\n
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
\r\n
import Updates from './updates/Updates'
\r\n\r\n
const Home = () => {
\r\n
const { authState, oktaAuth } = useOktaAuth();
\r\n
const [userInfo, setUserInfo] = useState(null);
\r\n\r\n
useEffect(() => {
\r\n
if (!authState.isAuthenticated) {
\r\n
// When user isn't authenticated, forget any user info
\r\n
setUserInfo(null);
\r\n
} else {
\r\n
oktaAuth.getUser().then(info => {
\r\n
setUserInfo(info);
\r\n
});
\r\n
}
\r\n
}, [authState, oktaAuth]); // Update if authState changes
\r\n\r\n
return (
\r\n
<div className=
\"
page-content-container
\"
>
\r\n
<div className=
\"
content-header
\"
>
\r\n
<h2 className=
\"
welcome-text
\"
>Welcome {userInfo ? userInfo.id :
\"
...
\"
}!</h2>
\r\n
<NavLink to=
\"
/reportissue
\"
>
\r\n
<button className=
\"
report-new-issue-button
\"
>
\r\n
<FontAwesomeIcon icon=
\"
exclamation-triangle
\"
></FontAwesomeIcon>
\r\n
Report issues
\r\n
</button>
\r\n
</NavLink>
\r\n
</div>
\r\n
<div className=
\"
homepage-content
\"
>
\r\n
<Updates />
\r\n
</div>
\r\n
</div>
\r\n
)
\r\n
}
\r\n\r\n
export default Home"
]},
"metadata"
:{},
"sourceType"
:
"module"
}
\ No newline at end of file
client/node_modules/.cache/babel-loader/d372c6c6cf01246ed5957a59e612def3.json
0 → 100644
View file @
0ba88032
This diff is collapsed.
Click to expand it.
client/node_modules/.cache/babel-loader/d382082f67e455ad43143fe8423abcd3.json
0 → 100644
View file @
0ba88032
{
"ast"
:
null
,
"code"
:
"var _jsxFileName =
\"
C:
\\\\
Users
\\\\
Bruger
\\\\
Desktop
\\\\
Web-projects
\\\\
pipit
\\\\
client
\\\\
src
\\\\
components
\\\\
home
\\\\
Home.jsx
\"
,
\n
_s = $RefreshSig$();
\n\n
import React, { useState, useEffect } from 'react';
\n
import { NavLink } from 'react-router-dom';
\n
import { useOktaAuth } from '@okta/okta-react';
\n
import
\"
./Home.css
\"
;
\n
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
\n
import Updates from './updates/Updates';
\n
import { jsxDEV as _jsxDEV } from
\"
react/jsx-dev-runtime
\"
;
\n\n
const Home = () => {
\n
_s();
\n\n
const {
\n
authState,
\n
oktaAuth
\n
} = useOktaAuth();
\n
const [userInfo, setUserInfo] = useState(null);
\n
useEffect(() => {
\n
if (!authState.isAuthenticated) {
\n
// When user isn't authenticated, forget any user info
\n
setUserInfo(null);
\n
} else {
\n
oktaAuth.getUser().then(info => {
\n
setUserInfo(info);
\n
});
\n
}
\n
}, [authState, oktaAuth]); // Update if authState changes
\n\n
return /*#__PURE__*/_jsxDEV(
\"
div
\"
, {
\n
className:
\"
page-content-container
\"
,
\n
children: [/*#__PURE__*/_jsxDEV(
\"
div
\"
, {
\n
className:
\"
content-header
\"
,
\n
children: [/*#__PURE__*/_jsxDEV(
\"
h2
\"
, {
\n
className:
\"
welcome-text
\"
,
\n
children: [
\"
Welcome
\"
, userInfo ? userInfo.email :
\"
...
\"
,
\"
!
\"
]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 26,
\n
columnNumber: 9
\n
}, this), /*#__PURE__*/_jsxDEV(NavLink, {
\n
to:
\"
/reportissue
\"
,
\n
children: /*#__PURE__*/_jsxDEV(
\"
button
\"
, {
\n
className:
\"
report-new-issue-button
\"
,
\n
children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {
\n
icon:
\"
exclamation-triangle
\"\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 29,
\n
columnNumber: 13
\n
}, this),
\"\\
xA0
\\
xA0Report issues
\"
]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 28,
\n
columnNumber: 11
\n
}, this)
\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 27,
\n
columnNumber: 9
\n
}, this)]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 25,
\n
columnNumber: 7
\n
}, this), /*#__PURE__*/_jsxDEV(
\"
div
\"
, {
\n
className:
\"
homepage-content
\"
,
\n
children: /*#__PURE__*/_jsxDEV(Updates, {}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 35,
\n
columnNumber: 9
\n
}, this)
\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 34,
\n
columnNumber: 7
\n
}, this)]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 24,
\n
columnNumber: 5
\n
}, this);
\n
};
\n\n
_s(Home,
\"
/7FunoA1ejJNU8uKGTy1GZFqU2I=
\"
, false, function () {
\n
return [useOktaAuth];
\n
});
\n\n
_c = Home;
\n
export default Home;
\n\n
var _c;
\n\n
$RefreshReg$(_c,
\"
Home
\"
);"
,
"map"
:{
"version"
:
3
,
"sources"
:[
"C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/home/Home.jsx"
],
"names"
:[
"React"
,
"useState"
,
"useEffect"
,
"NavLink"
,
"useOktaAuth"
,
"FontAwesomeIcon"
,
"Updates"
,
"Home"
,
"authState"
,
"oktaAuth"
,
"userInfo"
,
"setUserInfo"
,
"isAuthenticated"
,
"getUser"
,
"then"
,
"info"
,
"email"
],
"mappings"
:
";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,YAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAOC,OAAP,MAAoB,mBAApB;;;AAEA,MAAM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,IAAf"
,
"sourcesContent"
:[
"import React, { useState, useEffect } from 'react'
\r\n
import { NavLink } from 'react-router-dom'
\r\n
import { useOktaAuth } from '@okta/okta-react';
\r\n
import
\"
./Home.css
\"\r\n
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
\r\n
import Updates from './updates/Updates'
\r\n\r\n
const Home = () => {
\r\n
const { authState, oktaAuth } = useOktaAuth();
\r\n
const [userInfo, setUserInfo] = useState(null);
\r\n\r\n
useEffect(() => {
\r\n
if (!authState.isAuthenticated) {
\r\n
// When user isn't authenticated, forget any user info
\r\n
setUserInfo(null);
\r\n
} else {
\r\n
oktaAuth.getUser().then(info => {
\r\n
setUserInfo(info);
\r\n
});
\r\n
}
\r\n
}, [authState, oktaAuth]); // Update if authState changes
\r\n\r\n
return (
\r\n
<div className=
\"
page-content-container
\"
>
\r\n
<div className=
\"
content-header
\"
>
\r\n
<h2 className=
\"
welcome-text
\"
>Welcome {userInfo ? userInfo.email :
\"
...
\"
}!</h2>
\r\n
<NavLink to=
\"
/reportissue
\"
>
\r\n
<button className=
\"
report-new-issue-button
\"
>
\r\n
<FontAwesomeIcon icon=
\"
exclamation-triangle
\"
></FontAwesomeIcon>
\r\n
Report issues
\r\n
</button>
\r\n
</NavLink>
\r\n
</div>
\r\n
<div className=
\"
homepage-content
\"
>
\r\n
<Updates />
\r\n
</div>
\r\n
</div>
\r\n
)
\r\n
}
\r\n\r\n
export default Home"
]},
"metadata"
:{},
"sourceType"
:
"module"
}
\ No newline at end of file
client/node_modules/.cache/babel-loader/dde21f9d8731811961a464238ddf218c.json
0 → 100644
View file @
0ba88032
{
"ast"
:
null
,
"code"
:
"var _jsxFileName =
\"
C:
\\\\
Users
\\\\
Bruger
\\\\
Desktop
\\\\
Web-projects
\\\\
pipit
\\\\
client
\\\\
src
\\\\
components
\\\\
home
\\\\
Home.jsx
\"
,
\n
_s = $RefreshSig$();
\n\n
import React, { useState, useEffect } from 'react';
\n
import { NavLink } from 'react-router-dom';
\n
import { useOktaAuth } from '@okta/okta-react';
\n
import
\"
./Home.css
\"
;
\n
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
\n
import Updates from './updates/Updates';
\n
import { jsxDEV as _jsxDEV } from
\"
react/jsx-dev-runtime
\"
;
\n\n
const Home = () => {
\n
_s();
\n\n
const {
\n
authState,
\n
oktaAuth
\n
} = useOktaAuth();
\n
const [userInfo, setUserInfo] = useState(null);
\n
useEffect(() => {
\n
if (!authState.isAuthenticated) {
\n
// When user isn't authenticated, forget any user info
\n
setUserInfo(null);
\n
} else {
\n
oktaAuth.getUser().then(info => {
\n
setUserInfo(info);
\n
});
\n
}
\n
}, [authState, oktaAuth]); // Update if authState changes
\n\n
return /*#__PURE__*/_jsxDEV(
\"
div
\"
, {
\n
className:
\"
page-content-container
\"
,
\n
children: [/*#__PURE__*/_jsxDEV(
\"
div
\"
, {
\n
className:
\"
content-header
\"
,
\n
children: [/*#__PURE__*/_jsxDEV(
\"
h2
\"
, {
\n
className:
\"
welcome-text
\"
,
\n
children: [
\"
Welcome
\"
, userInfo ? userInfo.username :
\"
...
\"
,
\"
!
\"
]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 26,
\n
columnNumber: 9
\n
}, this), /*#__PURE__*/_jsxDEV(NavLink, {
\n
to:
\"
/reportissue
\"
,
\n
children: /*#__PURE__*/_jsxDEV(
\"
button
\"
, {
\n
className:
\"
report-new-issue-button
\"
,
\n
children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {
\n
icon:
\"
exclamation-triangle
\"\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 29,
\n
columnNumber: 13
\n
}, this),
\"\\
xA0
\\
xA0Report issues
\"
]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 28,
\n
columnNumber: 11
\n
}, this)
\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 27,
\n
columnNumber: 9
\n
}, this)]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 25,
\n
columnNumber: 7
\n
}, this), /*#__PURE__*/_jsxDEV(
\"
div
\"
, {
\n
className:
\"
homepage-content
\"
,
\n
children: /*#__PURE__*/_jsxDEV(Updates, {}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 35,
\n
columnNumber: 9
\n
}, this)
\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 34,
\n
columnNumber: 7
\n
}, this)]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 24,
\n
columnNumber: 5
\n
}, this);
\n
};
\n\n
_s(Home,
\"
/7FunoA1ejJNU8uKGTy1GZFqU2I=
\"
, false, function () {
\n
return [useOktaAuth];
\n
});
\n\n
_c = Home;
\n
export default Home;
\n\n
var _c;
\n\n
$RefreshReg$(_c,
\"
Home
\"
);"
,
"map"
:{
"version"
:
3
,
"sources"
:[
"C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/home/Home.jsx"
],
"names"
:[
"React"
,
"useState"
,
"useEffect"
,
"NavLink"
,
"useOktaAuth"
,
"FontAwesomeIcon"
,
"Updates"
,
"Home"
,
"authState"
,
"oktaAuth"
,
"userInfo"
,
"setUserInfo"
,
"isAuthenticated"
,
"getUser"
,
"then"
,
"info"
,
"username"
],
"mappings"
:
";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAO,YAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAOC,OAAP,MAAoB,mBAApB;;;AAEA,MAAMC,IAAI,GAAG,MAAM;AAAA;;AACjB,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BL,WAAW,EAA3C;AACA,QAAM,CAACM,QAAD,EAAWC,WAAX,IAA0BV,QAAQ,CAAC,IAAD,CAAxC;AAEAC,EAAAA,SAAS,CAAC,MAAM;AACd,QAAI,CAACM,SAAS,CAACI,eAAf,EAAgC;AAC9B;AACAD,MAAAA,WAAW,CAAC,IAAD,CAAX;AACD,KAHD,MAGO;AACLF,MAAAA,QAAQ,CAACI,OAAT,GAAmBC,IAAnB,CAAwBC,IAAI,IAAI;AAC9BJ,QAAAA,WAAW,CAACI,IAAD,CAAX;AACD,OAFD;AAGD;AACF,GATQ,EASN,CAACP,SAAD,EAAYC,QAAZ,CATM,CAAT,CAJiB,CAaU;;AAE3B,sBACE;AAAK,IAAA,SAAS,EAAC,wBAAf;AAAA,4BACE;AAAK,MAAA,SAAS,EAAC,gBAAf;AAAA,8BACE;AAAI,QAAA,SAAS,EAAC,cAAd;AAAA,+BAAsCC,QAAQ,GAAGA,QAAQ,CAACM,QAAZ,GAAuB,KAArE;AAAA;AAAA;AAAA;AAAA;AAAA,cADF,eAEE,QAAC,OAAD;AAAS,QAAA,EAAE,EAAC,cAAZ;AAAA,+BACE;AAAQ,UAAA,SAAS,EAAC,yBAAlB;AAAA,kCACE,QAAC,eAAD;AAAiB,YAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,kBADF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,cAFF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF,eAUE;AAAK,MAAA,SAAS,EAAC,kBAAf;AAAA,6BACE,QAAC,OAAD;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YAVF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAgBD,CA/BD;;GAAMT,I;UAC4BH,W;;;KAD5BG,I;AAiCN,eAAeA,IAAf"
,
"sourcesContent"
:[
"import React, { useState, useEffect } from 'react'
\r\n
import { NavLink } from 'react-router-dom'
\r\n
import { useOktaAuth } from '@okta/okta-react';
\r\n
import
\"
./Home.css
\"\r\n
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
\r\n
import Updates from './updates/Updates'
\r\n\r\n
const Home = () => {
\r\n
const { authState, oktaAuth } = useOktaAuth();
\r\n
const [userInfo, setUserInfo] = useState(null);
\r\n\r\n
useEffect(() => {
\r\n
if (!authState.isAuthenticated) {
\r\n
// When user isn't authenticated, forget any user info
\r\n
setUserInfo(null);
\r\n
} else {
\r\n
oktaAuth.getUser().then(info => {
\r\n
setUserInfo(info);
\r\n
});
\r\n
}
\r\n
}, [authState, oktaAuth]); // Update if authState changes
\r\n\r\n
return (
\r\n
<div className=
\"
page-content-container
\"
>
\r\n
<div className=
\"
content-header
\"
>
\r\n
<h2 className=
\"
welcome-text
\"
>Welcome {userInfo ? userInfo.username :
\"
...
\"
}!</h2>
\r\n
<NavLink to=
\"
/reportissue
\"
>
\r\n
<button className=
\"
report-new-issue-button
\"
>
\r\n
<FontAwesomeIcon icon=
\"
exclamation-triangle
\"
></FontAwesomeIcon>
\r\n
Report issues
\r\n
</button>
\r\n
</NavLink>
\r\n
</div>
\r\n
<div className=
\"
homepage-content
\"
>
\r\n
<Updates />
\r\n
</div>
\r\n
</div>
\r\n
)
\r\n
}
\r\n\r\n
export default Home"
]},
"metadata"
:{},
"sourceType"
:
"module"
}
\ No newline at end of file
client/src/components/login/Login.jsx
View file @
0ba88032
...
...
@@ -65,7 +65,7 @@ const SignUp = () => {
return
}
if
(
res
.
ok
)
{
handleSignInFormSubmit
()
handleSignInFormSubmit
(
e
)
}
})
}
...
...
serviceAPI/main.go
View file @
0ba88032
...
...
@@ -11,6 +11,7 @@ import (
"serviceAPI/service"
)
// TODO: Wrap "service.Authenticate()" around methods when done testing
func
main
()
{
oktaUtils
.
ParseEnvironment
()
router
:=
mux
.
NewRouter
()
...
...
@@ -20,7 +21,8 @@ func main() {
// User Request Endpoints
router
.
HandleFunc
(
"/api/get-users"
,
service
.
GetUsers
())
.
Methods
(
"GET"
)
router
.
HandleFunc
(
"/api/create-user"
,
service
.
CreateUser
())
.
Methods
(
"POST"
)
router
.
HandleFunc
(
"/api/create-user"
,
service
.
CreateUser
())
.
Methods
(
"POST"
)
router
.
HandleFunc
(
"/api/remove-user"
,
service
.
RemoveUser
())
.
Methods
(
"DELETE"
)
// Setup cors
...
...
serviceAPI/service/accountService.go
View file @
0ba88032
...
...
@@ -11,6 +11,7 @@ import (
)
type
User
struct
{
Id
string
`json:"id"`
FirstName
string
`json:"firstName"`
LastName
string
`json:"lastName"`
Email
string
`json:"email"`
...
...
@@ -23,7 +24,7 @@ type Users struct {
}
func
printUser
(
user
User
)
{
fmt
.
Print
ln
(
"Firstname:"
,
user
.
FirstName
,
"Lastname:"
,
user
.
LastName
,
"Email:"
,
user
.
Email
)
fmt
.
Print
(
"
\n
Firstname:"
,
user
.
FirstName
,
"
\n
Lastname:"
,
user
.
LastName
,
"
\n
Email:"
,
user
.
Email
)
}
func
printAllUsers
(
users
[]
User
)
{
...
...
@@ -53,6 +54,7 @@ func GetUsers() http.HandlerFunc {
for
_
,
user
:=
range
users
{
User
:=
User
{
Id
:
fmt
.
Sprintf
(
"%v"
,
(
*
user
.
Profile
)[
"Id"
]),
FirstName
:
fmt
.
Sprintf
(
"%v"
,
(
*
user
.
Profile
)[
"firstName"
]),
LastName
:
fmt
.
Sprintf
(
"%v"
,
(
*
user
.
Profile
)[
"lastName"
]),
Email
:
fmt
.
Sprintf
(
"%v"
,
(
*
user
.
Profile
)[
"email"
]),
...
...
@@ -85,19 +87,19 @@ func CreateUser() http.HandlerFunc {
return
}
new
UserData
:=
User
{}
temp
UserData
:=
User
{}
if
err
:=
json
.
NewDecoder
(
r
.
Body
)
.
Decode
(
&
new
UserData
);
if
err
:=
json
.
NewDecoder
(
r
.
Body
)
.
Decode
(
&
temp
UserData
);
err
!=
nil
{
ReturnError
(
w
,
http
.
StatusInternalServerError
,
err
.
Error
())
return
}
new
UserData
.
Login
=
new
UserData
.
Email
temp
UserData
.
Login
=
temp
UserData
.
Email
p
:=
&
okta
.
PasswordCredential
{
Value
:
new
UserData
.
Password
,
Value
:
temp
UserData
.
Password
,
}
uc
:=
&
okta
.
UserCredentials
{
...
...
@@ -105,10 +107,10 @@ func CreateUser() http.HandlerFunc {
}
profile
:=
okta
.
UserProfile
{}
profile
[
"firstName"
]
=
new
UserData
.
FirstName
profile
[
"lastName"
]
=
new
UserData
.
LastName
profile
[
"email"
]
=
new
UserData
.
Email
profile
[
"login"
]
=
new
UserData
.
Login
profile
[
"firstName"
]
=
temp
UserData
.
FirstName
profile
[
"lastName"
]
=
temp
UserData
.
LastName
profile
[
"email"
]
=
temp
UserData
.
Email
profile
[
"login"
]
=
temp
UserData
.
Login
u
:=
&
okta
.
CreateUserRequest
{
Credentials
:
uc
,
...
...
@@ -135,4 +137,54 @@ func CreateUser() http.HandlerFunc {
w
.
WriteHeader
(
http
.
StatusOK
)
}
}
func
RemoveUser
()
http
.
HandlerFunc
{
return
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
_
,
client
,
err
:=
okta
.
NewClient
(
context
.
Background
(),
okta
.
WithOrgUrl
(
"https://"
+
os
.
Getenv
(
"CLIENT_ID"
)),
okta
.
WithToken
(
"007XkBhvAfeVf1jUB0xhdwQJJEvWNSBQ6bbO4MoEaV"
))
if
err
!=
nil
{
ReturnError
(
w
,
http
.
StatusInternalServerError
,
err
.
Error
())
return
}
tempUserData
:=
User
{}
if
err
:=
json
.
NewDecoder
(
r
.
Body
)
.
Decode
(
&
tempUserData
);
err
!=
nil
{
ReturnError
(
w
,
http
.
StatusInternalServerError
,
err
.
Error
())
return
}
fmt
.
Println
(
"Removing User:"
,
tempUserData
.
Email
)
// User.Id == email
// Deactivate user first
resp
,
err
:=
client
.
User
.
DeactivateUser
(
context
.
Background
(),
tempUserData
.
Email
,
&
query
.
Params
{})
if
err
!=
nil
{
ReturnError
(
w
,
http
.
StatusInternalServerError
,
err
.
Error
())
return
}
// Response.Message?
if
_
,
err
:=
w
.
Write
([]
byte
(
resp
.
Self
));
err
!=
nil
{
ReturnError
(
w
,
http
.
StatusInternalServerError
,
err
.
Error
())
return
}
// Now Remove user
response
,
err
:=
client
.
User
.
DeactivateOrDeleteUser
(
context
.
Background
(),
"john-activate@example.com"
,
&
query
.
Params
{})
if
err
!=
nil
{
ReturnError
(
w
,
http
.
StatusInternalServerError
,
err
.
Error
())
return
}
if
_
,
err
:=
w
.
Write
([]
byte
(
response
.
Self
));
err
!=
nil
{
ReturnError
(
w
,
http
.
StatusInternalServerError
,
err
.
Error
())
return
}
fmt
.
Println
(
"User removal success"
)
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment