mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 08:37:22 +00:00
Update URL templates to use opts objects
This commit is contained in:
23 files changed
+67
-50
No files matched your search
@@ -30,7 +30,7 @@ export function useGitHubOAuth() {
|
||||
redirectUri: window.location.origin + '/oauth/github',
|
||||
usePKCE: true, // GitHub supports PKCE
|
||||
getUserInfo: async (accessToken: string, corsProxy: string) => {
|
||||
const userUrl = proxyUrl(corsProxy, 'https://api.github.com/user');
|
||||
const userUrl = proxyUrl({ template: corsProxy, url: 'https://api.github.com/user' });
|
||||
const userResponse = await fetch(userUrl, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${accessToken}`,
|
||||
|
||||
@@ -30,7 +30,7 @@ export function useNetlifyOAuth() {
|
||||
redirectUri: window.location.origin + '/oauth/netlify',
|
||||
usePKCE: false, // Netlify doesn't support PKCE
|
||||
getUserInfo: async (accessToken: string, corsProxy: string) => {
|
||||
const userUrl = proxyUrl(corsProxy, 'https://api.netlify.com/api/v1/user');
|
||||
const userUrl = proxyUrl({ template: corsProxy, url: 'https://api.netlify.com/api/v1/user' });
|
||||
const userResponse = await fetch(userUrl, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${accessToken}`,
|
||||
|
||||
@@ -169,7 +169,7 @@ export function useOAuth(config: OAuthConfig) {
|
||||
}
|
||||
|
||||
// Exchange code for access token
|
||||
const tokenUrl = proxyUrl(corsProxy, config.tokenUrl);
|
||||
const tokenUrl = proxyUrl({ template: corsProxy, url: config.tokenUrl });
|
||||
const tokenResponse = await fetch(tokenUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
||||
@@ -34,7 +34,7 @@ export function useVercelOAuth() {
|
||||
redirectUri: window.location.origin + '/oauth/vercel',
|
||||
usePKCE: false, // Vercel doesn't require PKCE
|
||||
getUserInfo: async (accessToken: string, corsProxy: string) => {
|
||||
const userUrl = proxyUrl(corsProxy, 'https://api.vercel.com/v2/user');
|
||||
const userUrl = proxyUrl({ template: corsProxy, url: 'https://api.vercel.com/v2/user' });
|
||||
const userResponse = await fetch(userUrl, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${accessToken}`,
|
||||
|
||||
Reference in new issue
Block a user