feat: use uuid for webhook id
This commit is contained in:
@@ -2,6 +2,7 @@ import { Router, Request, Response } from 'express';
|
|||||||
import Robot from '../models/Robot';
|
import Robot from '../models/Robot';
|
||||||
import { requireSignIn } from '../middlewares/auth';
|
import { requireSignIn } from '../middlewares/auth';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import { uuid } from "uuidv4";
|
||||||
|
|
||||||
export const router = Router();
|
export const router = Router();
|
||||||
|
|
||||||
@@ -85,7 +86,7 @@ router.post('/add', requireSignIn, async (req: Request, res: Response) => {
|
|||||||
|
|
||||||
const newWebhook: WebhookConfig = {
|
const newWebhook: WebhookConfig = {
|
||||||
...webhook,
|
...webhook,
|
||||||
id: webhook.id || Date.now().toString(),
|
id: webhook.id || uuid(),
|
||||||
createdAt: new Date().toISOString(),
|
createdAt: new Date().toISOString(),
|
||||||
updatedAt: new Date().toISOString(),
|
updatedAt: new Date().toISOString(),
|
||||||
lastCalledAt: null,
|
lastCalledAt: null,
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import axios from "axios";
|
|||||||
import { useGlobalInfoStore } from "../../context/globalInfo";
|
import { useGlobalInfoStore } from "../../context/globalInfo";
|
||||||
import { getStoredRecording } from "../../api/storage";
|
import { getStoredRecording } from "../../api/storage";
|
||||||
import { apiUrl } from "../../apiConfig.js";
|
import { apiUrl } from "../../apiConfig.js";
|
||||||
|
import { uuid } from "uuidv4";
|
||||||
|
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
|
|
||||||
@@ -189,7 +190,7 @@ export const IntegrationSettingsModal = ({
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
const webhookWithId = {
|
const webhookWithId = {
|
||||||
...newWebhook,
|
...newWebhook,
|
||||||
id: Date.now().toString(),
|
id: uuid(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await addWebhook(webhookWithId, recordingId);
|
const response = await addWebhook(webhookWithId, recordingId);
|
||||||
|
|||||||
Reference in New Issue
Block a user