2021-06-29 21:43:18 +00:00
|
|
|
import short from "short-uuid";
|
2021-09-22 19:52:38 +00:00
|
|
|
import { v5 as uuidv5 } from "uuid";
|
2021-09-23 08:49:17 +00:00
|
|
|
|
2021-09-22 19:52:38 +00:00
|
|
|
import { CalendarEvent } from "./calendarClient";
|
2021-11-26 11:03:43 +00:00
|
|
|
import { BASE_URL } from "./config/constants";
|
2021-06-29 21:43:18 +00:00
|
|
|
|
|
|
|
const translator = short();
|
|
|
|
|
2021-11-26 11:03:43 +00:00
|
|
|
export const getUid = (calEvent: CalendarEvent) => {
|
|
|
|
return calEvent.uid ?? translator.fromUUID(uuidv5(JSON.stringify(calEvent), uuidv5.URL));
|
|
|
|
};
|
2021-07-21 12:01:48 +00:00
|
|
|
|
2021-11-26 11:03:43 +00:00
|
|
|
export const getCancelLink = (calEvent: CalendarEvent) => {
|
|
|
|
return BASE_URL + "/cancel/" + getUid(calEvent);
|
|
|
|
};
|