Remove dependency on uuid package, and use crypto.randomUUID() instead

This commit is contained in:
Alejandro Celaya
2024-10-02 12:06:22 +02:00
parent a90ef56eb8
commit 69344a01ac
6 changed files with 14 additions and 37 deletions

View File

@@ -1,6 +1,5 @@
import type { PayloadAction } from '@reduxjs/toolkit';
import { createSlice } from '@reduxjs/toolkit';
import { v4 as uuid } from 'uuid';
import type { ServerData, ServersMap, ServerWithId } from '../data';
interface EditServer {
@@ -20,7 +19,7 @@ const serverWithId = (server: ServerWithId | ServerData): ServerWithId => {
return server;
}
return { ...server, id: uuid() };
return { ...server, id: crypto.randomUUID() };
};
const serversListToMap = (servers: ServerWithId[]): ServersMap => servers.reduce<ServersMap>(