mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 16:03:21 +00:00
feat: Utilisation d'une clef API Docuseal par établissement
This commit is contained in:
@ -3,18 +3,19 @@ import { BE_DOCUSEAL_CLONE_TEMPLATE } from '@/utils/Url';
|
||||
|
||||
export default function handler(req, res) {
|
||||
if (req.method === 'POST') {
|
||||
const { templateId, email, is_required } = req.body;
|
||||
const { templateId, email, is_required, establishment_id, apiDocuseal } = req.body;
|
||||
|
||||
fetch(BE_DOCUSEAL_CLONE_TEMPLATE, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Auth-Token': process.env.DOCUSEAL_API_KEY,
|
||||
'X-Auth-Token': apiDocuseal,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
templateId,
|
||||
email,
|
||||
is_required,
|
||||
establishment_id,
|
||||
}),
|
||||
})
|
||||
.then((response) => {
|
||||
|
||||
@ -3,13 +3,13 @@ import { BE_DOCUSEAL_DOWNLOAD_TEMPLATE } from '@/utils/Url';
|
||||
|
||||
export default function handler(req, res) {
|
||||
if (req.method === 'GET') {
|
||||
const { slug } = req.query;
|
||||
const { slug, establishment_id, apiDocuseal } = req.query;
|
||||
logger.debug('slug : ', slug);
|
||||
|
||||
fetch(`${BE_DOCUSEAL_DOWNLOAD_TEMPLATE}/${slug}`, {
|
||||
fetch(`${BE_DOCUSEAL_DOWNLOAD_TEMPLATE}/${slug}?establishment_id=${establishment_id}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'X-Auth-Token': process.env.DOCUSEAL_API_KEY,
|
||||
'X-Auth-Token': apiDocuseal,
|
||||
},
|
||||
})
|
||||
.then((response) => {
|
||||
|
||||
@ -3,13 +3,15 @@ import { BE_DOCUSEAL_GET_JWT } from '@/utils/Url';
|
||||
|
||||
export default function handler(req, res) {
|
||||
if (req.method === 'POST') {
|
||||
const { apiDocuseal, ...rest } = req.body;
|
||||
|
||||
fetch(BE_DOCUSEAL_GET_JWT, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Auth-Token': process.env.DOCUSEAL_API_KEY,
|
||||
'X-Auth-Token': apiDocuseal,
|
||||
},
|
||||
body: JSON.stringify(req.body),
|
||||
body: JSON.stringify(rest),
|
||||
})
|
||||
.then((response) => {
|
||||
logger.debug('Response status:', response.status);
|
||||
|
||||
@ -3,12 +3,12 @@ import { BE_DOCUSEAL_REMOVE_TEMPLATE } from '@/utils/Url';
|
||||
|
||||
export default function handler(req, res) {
|
||||
if (req.method === 'DELETE') {
|
||||
const { templateId } = req.body;
|
||||
const { templateId, establishment_id, apiDocuseal } = req.body;
|
||||
|
||||
fetch(`${BE_DOCUSEAL_REMOVE_TEMPLATE}/${templateId}`, {
|
||||
fetch(`${BE_DOCUSEAL_REMOVE_TEMPLATE}/${templateId}?establishment_id=${establishment_id}`, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'X-Auth-Token': process.env.DOCUSEAL_API_KEY,
|
||||
'X-Auth-Token': apiDocuseal,
|
||||
},
|
||||
})
|
||||
.then((response) => {
|
||||
|
||||
Reference in New Issue
Block a user