This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"workbench.iconTheme": "material-icon-theme", | |
"workbench.colorTheme": "Hack The Box-Lite", | |
"launch": { | |
"configurations": [], | |
"compounds": [] | |
}, | |
"editor.fontFamily": "Fira Code", | |
"editor.fontSize": 14, | |
"editor.lineHeight": 20, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const axios = require('axios'); | |
require('dotenv').config(); | |
const getData = async () => { | |
const result = await axios.get('https://next.json-generator.com/api/json/get/4JJYrbRxu'); | |
return result.data.map(person => ({ | |
age: person.age, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type PrintHtmlParams = { | |
/** | |
* `containerId`: | |
* - Index of the element where the content to be printed will be assembled | |
*/ | |
containerId: string; | |
/** | |
* `elementHtml`: | |
* - Content to be printed | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Encryption methods and encryption removal | |
*/ | |
# const encryptData = <T = unknown>(secretPass: string, data: T) => ... | |
# const decryptData = <T = unknown>(secretPass: string, encryptedData: string): T => ... | |
/** | |
* Secret key to use for encryption and decryption | |
*/ | |
# const SECRET_PASS_LOCAL_STORAGE = '...' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import CryptoJS from 'crypto-js'; | |
export const encryptData = <T = unknown>(secretPass: string, data: T) => { | |
const encryptedData = CryptoJS.AES.encrypt( | |
JSON.stringify(data), | |
secretPass, | |
).toString(); | |
return encryptedData; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { factory } from '@mswjs/data'; | |
import { http, HttpResponse } from 'msw'; | |
import { faker } from '@faker-js/faker'; | |
import { primaryKey } from '@mswjs/data'; | |
type User = { | |
id: string; | |
firstName: string; | |
}; |