web: People: Moved api methods: resendUserInvites and getShortenedLink into ASC.Web.Common

This commit is contained in:
Alexey Safronov 2019-11-18 13:52:37 +03:00
parent 85d6847e29
commit 18b0cdab2d
10 changed files with 30 additions and 73 deletions

View File

@ -11,12 +11,13 @@ import {
Textarea,
Text
} from "asc-web-components";
import { getShortenedLink } from "../../../store/services/api";
import { withTranslation, I18nextProvider } from "react-i18next";
import i18n from "./i18n";
import { typeGuests } from "./../../../helpers/customNames";
import styled from "styled-components";
import copy from "copy-to-clipboard";
import { api } from "asc-web-common";
const { getShortenedLink } = api.portal;
const ModalDialogContainer = styled.div`
.margin-text {

View File

@ -32,14 +32,14 @@ import {
} from "../../../../../store/people/selectors";
import { EmployeeStatus } from "../../../../../helpers/constants";
import {
resendUserInvites,
sendInstructionsToDelete,
sendInstructionsToChangePassword,
deleteUser
} from "../../../../../store/services/api";
import { isMobileOnly } from "react-device-detect";
import { store } from 'asc-web-common';
import { store, api } from 'asc-web-common';
const { isAdmin, isMe } = store.auth.selectors;
const { resendUserInvites } = api.people;
class SectionBodyContent extends React.PureComponent {

View File

@ -26,12 +26,12 @@ import {
typeGuest
} from "../../../../../helpers/../helpers/customNames";
import {
resendUserInvites,
deleteUsers
} from "../../../../../store/services/api";
import { deleteGroup } from "../../../../../store/group/actions";
import { store } from 'asc-web-common';
import { store, api } from 'asc-web-common';
const { isAdmin } = store.auth.selectors;
const { resendUserInvites } = api.people;
const StyledContainer = styled.div`
.group-button-menu-container {

View File

@ -1,7 +1,7 @@
import React from "react";
import { Trans } from 'react-i18next';
import { department as departmentName, position, employedSinceDate } from '../../../../../../helpers/customNames';
import { resendUserInvites, sendInstructionsToChangeEmail } from "../../../../../../store/services/api";
import { sendInstructionsToChangeEmail } from "../../../../../../store/services/api";
import {
Text,
TextInput,
@ -14,7 +14,8 @@ import {
HelpButton
} from "asc-web-components";
import styled from 'styled-components';
import { history } from "asc-web-common";
import { history, api } from "asc-web-common";
const { resendUserInvites } = api.people;
const InfoContainer = styled.div`
margin-bottom: 24px;

View File

@ -15,7 +15,6 @@ import {
import { withRouter } from "react-router";
import { getUserStatus, toEmployeeWrapper } from "../../../../../store/people/selectors";
import { withTranslation } from 'react-i18next';
import { resendUserInvites } from "../../../../../store/services/api";
import { EmployeeStatus } from "../../../../../helpers/constants";
import { updateUserStatus, fetchPeople } from "../../../../../store/people/actions";
import { fetchProfile } from '../../../../../store/profile/actions';
@ -29,8 +28,9 @@ import {
deleteUser
} from "../../../../../store/services/api";
import styled from 'styled-components';
import { store } from 'asc-web-common';
import { store, api } from 'asc-web-common';
const { isAdmin, isMe } = store.auth.selectors;
const { resendUserInvites } = api.people;
const wrapperStyle = {
display: "flex",

View File

@ -173,14 +173,6 @@ export function updateUserType(type, userIds) {
});
}
export function resendUserInvites(userIds) {
return request({
method: "put",
url: "/people/invite",
data: { userIds }
});
}
export function sendInstructionsToDelete() {
return request({
method: "put",
@ -261,14 +253,6 @@ export function getInvitationLink(isGuest) {
});
}
export function getShortenedLink(link) {
return request({
method: "put",
url: "/portal/getshortenlink.json",
data: link
});
}
export function createGroup(groupName, groupManager, members) {
const data = { groupName, groupManager, members };
return request({

View File

@ -381,53 +381,6 @@ export function updateUserType(type, userIds) {
]);
}
export function resendUserInvites(userIds) {
return fakeResponse([
{
id: userIds[0],
userName: "Mike.Zanyatski",
isVisitor: false,
firstName: "Mike",
lastName: "Zanyatski",
email: "my@gmail.com",
birthday: "2019-08-19T01:39:25.3240031Z",
sex: "male",
status: 1,
activationStatus: 0,
terminated: "2019-08-19T01:39:25.3240031Z",
department: "Marketing",
workFrom: "2019-08-19T01:39:25.3240031Z",
location: "Palo Alto",
notes: "Notes to worker",
displayName: null,
title: "Manager",
contacts: [
{
type: "GTalk",
value: "my@gmail.com"
}
],
groups: [
{
id: "00000000-0000-0000-0000-000000000000",
name: "Group Name",
manager: "Jake.Zazhitski"
}
],
avatarMedium: "url to medium avatar",
avatar: "url to big avatar",
isAdmin: false,
isLDAP: false,
listAdminModules: ["projects", "crm"],
isOwner: false,
cultureName: "en-EN",
isSSO: false,
avatarSmall: "url to small avatar",
profileUrl: ""
}
]);
}
export function deleteUser(userId) {
return fakeResponse([
{

View File

@ -3,5 +3,6 @@ import * as people from './people';
import * as user from './user';
import * as settings from './settings';
import * as modules from './modules';
import * as portal from './portal';
export default { Filter, people, user, settings, modules };
export default { Filter, people, user, settings, modules, portal };

View File

@ -124,4 +124,12 @@ export function getUserList(filter = Filter.getDefault()) {
method: "get",
url: `/people/${userId}`
});
}
export function resendUserInvites(userIds) {
return request({
method: "put",
url: "/people/invite",
data: { userIds }
});
}

View File

@ -0,0 +1,9 @@
import { request } from "../client";
export function getShortenedLink(link) {
return request({
method: "put",
url: "/portal/getshortenlink.json",
data: link
});
}