feat: oauth-based login (#7)

This commit is contained in:
Roberto Vidal
2024-07-29 19:31:45 +01:00
committed by GitHub
parent b8a197ed16
commit 7ebc805ffa
17 changed files with 523 additions and 102 deletions

View File

@@ -0,0 +1,14 @@
type CommonRequest = Omit<RequestInit, 'body'> & { body?: URLSearchParams };
export async function request(url: string, init?: CommonRequest) {
if (import.meta.env.DEV) {
const nodeFetch = await import('node-fetch');
const https = await import('node:https');
const agent = url.startsWith('https') ? new https.Agent({ rejectUnauthorized: false }) : undefined;
return nodeFetch.default(url, { ...init, agent });
}
return fetch(url, init);
}