mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
fixing edit login modal
This commit is contained in:
parent
c144356252
commit
e0e0d4c621
51
doc/api.oa3
51
doc/api.oa3
@ -184,35 +184,6 @@ paths:
|
|||||||
'500':
|
'500':
|
||||||
description: internal server error
|
description: internal server error
|
||||||
|
|
||||||
/admin/accounts/{accountId}/reset:
|
|
||||||
put:
|
|
||||||
tags:
|
|
||||||
- admin
|
|
||||||
description: Generate a password reset url for specified account. Access granted to admin username and password.
|
|
||||||
operationId: set-node-account
|
|
||||||
security:
|
|
||||||
- basicAuth: []
|
|
||||||
parameters:
|
|
||||||
- name: accountId
|
|
||||||
in: path
|
|
||||||
description: id of profile to access
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
responses:
|
|
||||||
'201':
|
|
||||||
description: success
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: string
|
|
||||||
'401':
|
|
||||||
description: invalid password
|
|
||||||
'404':
|
|
||||||
description: unknown portal
|
|
||||||
'500':
|
|
||||||
description: internal server error
|
|
||||||
|
|
||||||
/admin/accounts/{accountId}:
|
/admin/accounts/{accountId}:
|
||||||
delete:
|
delete:
|
||||||
tags:
|
tags:
|
||||||
@ -461,6 +432,28 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
|
||||||
|
/account/login:
|
||||||
|
put:
|
||||||
|
tags:
|
||||||
|
- account
|
||||||
|
description: Reset account login credentials
|
||||||
|
operationId: set-account-login
|
||||||
|
security:
|
||||||
|
- basicAuth: []
|
||||||
|
responses:
|
||||||
|
'201':
|
||||||
|
description: success
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
'401':
|
||||||
|
description: invalid password
|
||||||
|
'404':
|
||||||
|
description: unknown portal
|
||||||
|
'500':
|
||||||
|
description: internal server error
|
||||||
|
|
||||||
/account/profile:
|
/account/profile:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
|
@ -84,9 +84,8 @@ export function Conversation() {
|
|||||||
<BusySpin size="large" delay="1000" spinning={!state.init} />
|
<BusySpin size="large" delay="1000" spinning={!state.init} />
|
||||||
</div>
|
</div>
|
||||||
<AddTopic />
|
<AddTopic />
|
||||||
<Modal title="Conversation Members" visible={showMembers} centered onCancel={() => setShowMembers(false)} width={400} bodyStyle={{ padding: 0 }}
|
<Modal title="Conversation Members" visible={showMembers} centered onCancel={() => setShowMembers(false)}
|
||||||
footer={[
|
width={400} bodyStyle={{ padding: 0 }} footer={[]} >
|
||||||
]} >
|
|
||||||
<Members host={state.cardId} members={state.members} />
|
<Members host={state.cardId} members={state.members} />
|
||||||
</Modal>
|
</Modal>
|
||||||
<Modal title="Edit Subject" visible={showEdit} centered
|
<Modal title="Edit Subject" visible={showEdit} centered
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import { Button, Select, Modal, Collapse, Input } from 'antd';
|
import { Space, Button, Select, Modal, Collapse, Input } from 'antd';
|
||||||
import { SelectItem, ConversationWrapper, Description, BusySpin } from './AddChannel.styled';
|
import { SelectItem, ConversationWrapper, Description, BusySpin } from './AddChannel.styled';
|
||||||
import { Logo } from '../../../../../Logo/Logo';
|
import { Logo } from '../../../../../Logo/Logo';
|
||||||
|
|
||||||
@ -18,6 +18,9 @@ export function AddChannel({ state, actions }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<ConversationWrapper>
|
<ConversationWrapper>
|
||||||
|
<Space direction="vertical">
|
||||||
|
<Input placeholder="Subject (optional)" onChange={(e) => actions.setStartSubject(e.target.value)}
|
||||||
|
value={state.startSubject} />
|
||||||
<Select
|
<Select
|
||||||
mode="multiple"
|
mode="multiple"
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
@ -27,13 +30,7 @@ export function AddChannel({ state, actions }) {
|
|||||||
onChange={(value) => actions.setStartCards(value)}
|
onChange={(value) => actions.setStartCards(value)}
|
||||||
optionLabelProp="label"
|
optionLabelProp="label"
|
||||||
/>
|
/>
|
||||||
<Collapse ghost="true">
|
</Space>
|
||||||
<Collapse.Panel header="Conversation Details (optional)" key="1">
|
|
||||||
<Input placeholder="Subject" onChange={(e) => actions.setStartSubject(e.target.value)} value={state.startSubject} />
|
|
||||||
<Description placeholder="Description" autoSize={{ minRows: 2, maxRows: 6 }}
|
|
||||||
onChange={(e) => actions.setStartDescription(e.target.value)} value={state.startDescription} />
|
|
||||||
</Collapse.Panel>
|
|
||||||
</Collapse>
|
|
||||||
<BusySpin size="large" spinning={state.busy} />
|
<BusySpin size="large" spinning={state.busy} />
|
||||||
</ConversationWrapper>
|
</ConversationWrapper>
|
||||||
)
|
)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Avatar, Space, Image, Modal, Form, Input } from 'antd';
|
import { Avatar, Space, Image, Modal, Form, Input, Button } from 'antd';
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import { IdentityWrapper, IdentityDropdown, MenuWrapper } from './Identity.styled';
|
import { IdentityWrapper, IdentityDropdown, MenuWrapper } from './Identity.styled';
|
||||||
import { RightOutlined, EditOutlined, UserOutlined, LockOutlined } from '@ant-design/icons';
|
import { RightOutlined, EditOutlined, UserOutlined, LockOutlined } from '@ant-design/icons';
|
||||||
@ -8,7 +8,6 @@ import { Logo } from '../../../Logo/Logo';
|
|||||||
|
|
||||||
export function Identity() {
|
export function Identity() {
|
||||||
|
|
||||||
const [ showLogin, setShowLogin ] = useState(false);
|
|
||||||
const { state, actions } = useIdentity()
|
const { state, actions } = useIdentity()
|
||||||
|
|
||||||
const menu = (
|
const menu = (
|
||||||
@ -17,7 +16,7 @@ export function Identity() {
|
|||||||
<div onClick={() => actions.editProfile()}>Edit Profile</div>
|
<div onClick={() => actions.editProfile()}>Edit Profile</div>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="1">
|
<Menu.Item key="1">
|
||||||
<div onClick={() => setShowLogin(true)}>Change Login</div>
|
<div onClick={() => actions.setShowLogin(true)}>Change Login</div>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="2">
|
<Menu.Item key="2">
|
||||||
<div onClick={() => actions.logout()}>Sign Out</div>
|
<div onClick={() => actions.logout()}>Sign Out</div>
|
||||||
@ -25,11 +24,6 @@ export function Identity() {
|
|||||||
</MenuWrapper>
|
</MenuWrapper>
|
||||||
);
|
);
|
||||||
|
|
||||||
const onChangeLogin = () => {
|
|
||||||
let saved = actions.setLogin();
|
|
||||||
setShowLogin(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<IdentityWrapper>
|
<IdentityWrapper>
|
||||||
<IdentityDropdown overlay={menu} overlayStyle={{ minWidth: 0 }} trigger={['click']} placement="rightTop">
|
<IdentityDropdown overlay={menu} overlayStyle={{ minWidth: 0 }} trigger={['click']} placement="rightTop">
|
||||||
@ -44,8 +38,12 @@ export function Identity() {
|
|||||||
<RightOutlined />
|
<RightOutlined />
|
||||||
</div>
|
</div>
|
||||||
</IdentityDropdown>
|
</IdentityDropdown>
|
||||||
<Modal title="Change Login" visible={showLogin} centered okText="Save"
|
<Modal title="Account Login" visible={state.showLogin} centered okText="Save"
|
||||||
onOk={() => onChangeLogin()} onCancel={() => setShowLogin(false)}>
|
onCancel={() => actions.setShowLogin(false)} loading={state.busy}
|
||||||
|
footer={[
|
||||||
|
<Button key="back" onClick={() => actions.setShowLogin(false)}>Cancel</Button>,
|
||||||
|
<Button key="save" type="primary" onClick={() => actions.setLogin()}>Save</Button>
|
||||||
|
]}>
|
||||||
|
|
||||||
<Space direction="vertical" style={{ width: '100%' }}>
|
<Space direction="vertical" style={{ width: '100%' }}>
|
||||||
<Input size="large" spelleCheck="false" placeholder="Username" prefix={<UserOutlined />}
|
<Input size="large" spelleCheck="false" placeholder="Username" prefix={<UserOutlined />}
|
||||||
|
@ -20,7 +20,8 @@ export function useIdentity() {
|
|||||||
passwordStatus: null,
|
passwordStatus: null,
|
||||||
confirm: null,
|
confirm: null,
|
||||||
confirmStatus: null,
|
confirmStatus: null,
|
||||||
|
busy: false,
|
||||||
|
showLogin: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -69,6 +70,9 @@ export function useIdentity() {
|
|||||||
setConfirm: (value) => {
|
setConfirm: (value) => {
|
||||||
updateState({ confirm: value });
|
updateState({ confirm: value });
|
||||||
},
|
},
|
||||||
|
setShowLogin: (value) => {
|
||||||
|
updateState({ showLogin: value });
|
||||||
|
},
|
||||||
setLogin: async () => {
|
setLogin: async () => {
|
||||||
if (state.username == null || state.username == '') {
|
if (state.username == null || state.username == '') {
|
||||||
updateState({ usernameStatus: 'username required' });
|
updateState({ usernameStatus: 'username required' });
|
||||||
@ -91,7 +95,17 @@ export function useIdentity() {
|
|||||||
else {
|
else {
|
||||||
updateState({ confirmStatus: null });
|
updateState({ confirmStatus: null });
|
||||||
}
|
}
|
||||||
|
if (!state.busy) {
|
||||||
|
updateState({ busy: true });
|
||||||
|
try {
|
||||||
await account.actions.setLogin(state.username, state.password);
|
await account.actions.setLogin(state.username, state.password);
|
||||||
|
updateState({ showLogin: false });
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
window.alert(err);
|
||||||
|
}
|
||||||
|
updateState({ busy: false });
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user