|
|
@@ -7,21 +7,10 @@ import {
|
|
|
import { message } from "antd";
|
|
|
import { post } from "../../request";
|
|
|
import { useRef } from "react";
|
|
|
-import { IInviteData } from "../../pages/studio/invite/list";
|
|
|
import LangSelect from "../general/LangSelect";
|
|
|
import { dashboardBasePath } from "../../utils";
|
|
|
+import { IInviteRequest, IInviteResponse } from "../api/Auth";
|
|
|
|
|
|
-interface IInviteRequest {
|
|
|
- email: string;
|
|
|
- lang: string;
|
|
|
- studio: string;
|
|
|
- dashboard?: string;
|
|
|
-}
|
|
|
-interface IInviteResponse {
|
|
|
- ok: boolean;
|
|
|
- message: string;
|
|
|
- data: IInviteData;
|
|
|
-}
|
|
|
interface IFormData {
|
|
|
email: string;
|
|
|
lang: string;
|
|
|
@@ -42,14 +31,16 @@ const InviteCreateWidget = ({ studio, onCreate }: IWidget) => {
|
|
|
if (typeof studio === "undefined") {
|
|
|
return;
|
|
|
}
|
|
|
- console.log(values);
|
|
|
- const res = await post<IInviteRequest, IInviteResponse>(`/v2/invite`, {
|
|
|
+ const url = `/v2/invite`;
|
|
|
+ const data: IInviteRequest = {
|
|
|
email: values.email,
|
|
|
lang: values.lang,
|
|
|
studio: studio,
|
|
|
dashboard: dashboardBasePath(),
|
|
|
- });
|
|
|
- console.log(res);
|
|
|
+ };
|
|
|
+ console.info("api request", values);
|
|
|
+ const res = await post<IInviteRequest, IInviteResponse>(url, data);
|
|
|
+ console.debug("api response", res);
|
|
|
if (res.ok) {
|
|
|
message.success(intl.formatMessage({ id: "flashes.success" }));
|
|
|
if (typeof onCreate !== "undefined") {
|