Skip to content
GitLab
Menu
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
7f0c1ae3
Commit
7f0c1ae3
authored
Aug 30, 2021
by
Mathias Engelbrecht Pilegård
Browse files
added ability to remove account from account page
parent
a26e7d3e
Changes
48
Expand all
Hide whitespace changes
Inline
Side-by-side
client/node_modules/.cache/babel-loader/d69260d92dd6772aa0aad2b88f9b1b61.json
0 → 100644
View file @
7f0c1ae3
{
"ast"
:
null
,
"code"
:
"var _jsxFileName =
\"
C:
\\\\
Users
\\\\
Bruger
\\\\
Desktop
\\\\
Web-projects
\\\\
pipit
\\\\
client
\\\\
src
\\\\
components
\\\\
confirmRemoveAccountModal
\\\\
ConfirmRemoveAccountModal.jsx
\"
;
\n
import React from 'react';
\n
import { jsxDEV as _jsxDEV } from
\"
react/jsx-dev-runtime
\"
;
\n\n
const YesNoModal = ({
\n
removeModal,
\n
headerMessage,
\n
bodyMessage
\n
}) => {
\n
const stopProp = e => {
\n
e.stopPropagation();
\n
};
\n\n
return /*#__PURE__*/_jsxDEV(
\"
div
\"
, {
\n
className:
\"
modal-content
\"
,
\n
onClick: e => removeModal(),
\n
children: /*#__PURE__*/_jsxDEV(
\"
div
\"
, {
\n
className:
\"
yes-no-modal
\"
,
\n
children: [/*#__PURE__*/_jsxDEV(
\"
h2
\"
, {
\n
children: headerMessage
\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 11,
\n
columnNumber: 9
\n
}, this), /*#__PURE__*/_jsxDEV(
\"
label
\"
, {
\n
children: bodyMessage
\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 12,
\n
columnNumber: 9
\n
}, this), /*#__PURE__*/_jsxDEV(
\"
button
\"
, {
\n
children:
\"
Yes
\"\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 15,
\n
columnNumber: 9
\n
}, this), /*#__PURE__*/_jsxDEV(
\"
button
\"
, {
\n
className:
\"
formSubmitButton
\"
,
\n
onClick: e => removeModal(),
\n
children:
\"
No
\"\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 18,
\n
columnNumber: 9
\n
}, this)]
\n
}, void 0, true, {
\n
fileName: _jsxFileName,
\n
lineNumber: 10,
\n
columnNumber: 7
\n
}, this)
\n
}, void 0, false, {
\n
fileName: _jsxFileName,
\n
lineNumber: 9,
\n
columnNumber: 5
\n
}, this);
\n
};
\n\n
_c = YesNoModal;
\n
export default YesNoModal;
\n\n
var _c;
\n\n
$RefreshReg$(_c,
\"
YesNoModal
\"
);"
,
"map"
:{
"version"
:
3
,
"sources"
:[
"C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/confirmRemoveAccountModal/ConfirmRemoveAccountModal.jsx"
],
"names"
:[
"React"
,
"YesNoModal"
,
"removeModal"
,
"headerMessage"
,
"bodyMessage"
,
"stopProp"
,
"e"
,
"stopPropagation"
],
"mappings"
:
";AAAA,OAAOA,KAAP,MAAkB,OAAlB;;;AAEA,MAAMC,UAAU,GAAG,CAAC;AAAEC,EAAAA,WAAF;AAAeC,EAAAA,aAAf;AAA8BC,EAAAA;AAA9B,CAAD,KAAiD;AAClE,QAAMC,QAAQ,GAAGC,CAAC,IAAI;AACpBA,IAAAA,CAAC,CAACC,eAAF;AACD,GAFD;;AAIA,sBACE;AAAK,IAAA,SAAS,EAAC,eAAf;AAA+B,IAAA,OAAO,EAAED,CAAC,IAAIJ,WAAW,EAAxD;AAAA,2BACE;AAAK,MAAA,SAAS,EAAC,cAAf;AAAA,8BACE;AAAA,kBAAKC;AAAL;AAAA;AAAA;AAAA;AAAA,cADF,eAEE;AAAA,kBACGC;AADH;AAAA;AAAA;AAAA;AAAA,cAFF,eAKE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cALF,eAQE;AAAQ,QAAA,SAAS,EAAC,kBAAlB;AAAqC,QAAA,OAAO,EAAEE,CAAC,IAAIJ,WAAW,EAA9D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cARF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAgBD,CArBD;;KAAMD,U;AAuBN,eAAeA,UAAf"
,
"sourcesContent"
:[
"import React from 'react'
\r\n\r\n
const YesNoModal = ({ removeModal, headerMessage, bodyMessage }) => {
\r\n
const stopProp = e => {
\r\n
e.stopPropagation()
\r\n
}
\r\n\r\n
return (
\r\n
<div className=
\"
modal-content
\"
onClick={e => removeModal()}>
\r\n
<div className=
\"
yes-no-modal
\"
>
\r\n
<h2>{headerMessage}</h2>
\r\n
<label>
\r\n
{bodyMessage}
\r\n
</label>
\r\n
<button>
\r\n
Yes
\r\n
</button>
\r\n
<button className=
\"
formSubmitButton
\"
onClick={e => removeModal()}>
\r\n
No
\r\n
</button>
\r\n
</div>
\r\n
</div>
\r\n
)
\r\n
}
\r\n\r\n
export default YesNoModal
\r\n
"
]},
"metadata"
:{},
"sourceType"
:
"module"
}
\ No newline at end of file
client/node_modules/.cache/babel-loader/e916309ae1a7667b3e6e09c57909d636.json
0 → 100644
View file @
7f0c1ae3
This diff is collapsed.
Click to expand it.
client/src/components/confirmRemoveAccountModal/ConfirmRemoveAccountModal.css
0 → 100644
View file @
7f0c1ae3
.confirmRemoveAccountModal
.buttonContainer
{
margin-top
:
10px
;
display
:
flex
;
}
.confirmRemoveAccountModal
.buttonContainer
.noButton
{
margin-right
:
10px
;
background-color
:
white
;
color
:
black
;
border-color
:
black
;
}
.confirmRemoveAccountModal
.buttonContainer
.yesButton
{
margin-left
:
10px
;
}
\ No newline at end of file
client/src/components/confirmRemoveAccountModal/ConfirmRemoveAccountModal.jsx
0 → 100644
View file @
7f0c1ae3
import
React
,
{
useEffect
,
useState
}
from
'
react
'
import
{
useOktaAuth
}
from
'
@okta/okta-react
'
;
import
"
./ConfirmRemoveAccountModal.css
"
import
config
from
'
../../config
'
;
const
ConfirmRemoveAccountModal
=
({
removeModal
,
headerMessage
,
bodyMessage
})
=>
{
const
{
authState
,
oktaAuth
}
=
useOktaAuth
();
const
[
userInfo
,
setUserInfo
]
=
useState
(
null
);
const
stopProp
=
e
=>
{
e
.
stopPropagation
()
}
useEffect
(()
=>
{
if
(
!
authState
.
isAuthenticated
)
{
// When user isn't authenticated, forget any user info
setUserInfo
(
null
);
}
else
{
oktaAuth
.
getUser
().
then
(
info
=>
{
setUserInfo
(
info
);
});
}
},
[
authState
,
oktaAuth
]);
// Update if authState changes
const
removeAccountRequestOptions
=
{
method
:
'
DELETE
'
,
body
:
JSON
.
stringify
(
{
email
:
`
${
userInfo
&&
userInfo
.
email
}
`
,
}
)
}
const
handleRemoveAccount
=
()
=>
{
console
.
log
(
removeAccountRequestOptions
.
body
)
fetch
(
config
.
serviceAPI
.
removeAccountURL
,
removeAccountRequestOptions
)
.
then
((
res
)
=>
{
if
(
!
res
.
ok
)
{
console
.
log
(
res
)
window
.
alert
(
"
Error
"
)
Promise
.
reject
(
""
)
return
}
if
(
res
.
ok
)
{
oktaAuth
.
signOut
()
}
})
}
return
(
<
div
className
=
"modal-content"
>
<
div
className
=
"confirmRemoveAccountModal"
>
<
h2
>
Delete account
</
h2
>
<
label
>
Are you sure you want to delete your account?
</
label
>
<
div
className
=
"buttonContainer"
>
<
button
className
=
"noButton"
onClick
=
{
e
=>
removeModal
()
}
>
No
</
button
>
<
button
className
=
"yesButton"
onClick
=
{
handleRemoveAccount
}
>
Yes
</
button
>
</
div
>
</
div
>
</
div
>
)
}
export
default
ConfirmRemoveAccountModal
client/src/components/messageModal/MessageModal.jsx
View file @
7f0c1ae3
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'
react
'
import
React
from
'
react
'
const
MessageModal
=
({
removeModal
,
headerMessage
,
bodyMessage
})
=>
{
const
stopProp
=
e
=>
{
...
...
client/src/pages/account/Account.jsx
View file @
7f0c1ae3
This diff is collapsed.
Click to expand it.
serviceAPI/main.go
View file @
7f0c1ae3
This diff is collapsed.
Click to expand it.
serviceAPI/service/accountService.go
View file @
7f0c1ae3
This diff is collapsed.
Click to expand it.
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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