Send invitation email connected
This commit is contained in:
parent
62997b8f4d
commit
bd6cd5995a
@ -3,7 +3,7 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev -p 5005",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
import BaseAdmin from "../../../../../common/Api/LeCoffreApi/Admin/BaseAdmin";
|
||||||
|
|
||||||
|
export interface IPostSubscriptionsParams {
|
||||||
|
emails: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class Subscriptions extends BaseAdmin {
|
||||||
|
private static instance: Subscriptions;
|
||||||
|
private readonly baseURl = this.namespaceUrl.concat("/subscriptions");
|
||||||
|
|
||||||
|
private constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getInstance() {
|
||||||
|
if (!this.instance) {
|
||||||
|
return new this();
|
||||||
|
} else {
|
||||||
|
return this.instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : Create a Document
|
||||||
|
*/
|
||||||
|
public async post(body: IPostSubscriptionsParams) {
|
||||||
|
const url = new URL(this.baseURl.concat(`/invite`));
|
||||||
|
try {
|
||||||
|
return await this.postRequest(url, body as any);
|
||||||
|
} catch (err) {
|
||||||
|
this.onError(err);
|
||||||
|
return Promise.reject(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,7 @@ import { useRouter } from "next/router";
|
|||||||
import TextField from "@Front/Components/DesignSystem/Form/TextField";
|
import TextField from "@Front/Components/DesignSystem/Form/TextField";
|
||||||
import Button from "@Front/Components/DesignSystem/Button";
|
import Button from "@Front/Components/DesignSystem/Button";
|
||||||
import Form from "@Front/Components/DesignSystem/Form";
|
import Form from "@Front/Components/DesignSystem/Form";
|
||||||
|
import Subscriptions from "@Front/Api/LeCoffreApi/Admin/Subscriptions/Subscriptions";
|
||||||
|
|
||||||
export enum EForfeitType {
|
export enum EForfeitType {
|
||||||
"standard",
|
"standard",
|
||||||
@ -14,7 +15,7 @@ export default function SubscriptionInvite() {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const nbOfCollaborators = parseInt(router.query["nbOfCollaborators"] as string);
|
const nbOfCollaborators = parseInt(router.query["nbOfCollaborators"] as string);
|
||||||
|
|
||||||
const sendInvitations = (e: React.FormEvent<HTMLFormElement> | null) => {
|
const sendInvitations = async (e: React.FormEvent<HTMLFormElement> | null) => {
|
||||||
if (!e) return;
|
if (!e) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const form = e.target as HTMLFormElement;
|
const form = e.target as HTMLFormElement;
|
||||||
@ -26,8 +27,14 @@ export default function SubscriptionInvite() {
|
|||||||
emails.push(element.value);
|
emails.push(element.value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
const body = {
|
||||||
console.log(emails);
|
emails,
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
await Subscriptions.getInstance().post(body);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<DefaultTemplate title="Nouvelle souscription" hasHeaderLinks={false}>
|
<DefaultTemplate title="Nouvelle souscription" hasHeaderLinks={false}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user