-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from CodeCrowCorp/dev
Fix: unaccessible stores
- Loading branch information
Showing
8 changed files
with
136 additions
and
149 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,60 @@ | ||
import { | ||
PUBLIC_GOOGLE_OAUTH_CLIENT_ID, | ||
PUBLIC_GOOGLE_OAUTH_REDIRECT_URL, | ||
PUBLIC_GITHUB_OAUTH_CLIENT_ID, | ||
PUBLIC_GITHUB_OAUTH_REDIRECT_URL, | ||
PUBLIC_DISCORD_OAUTH_CLIENT_ID, | ||
PUBLIC_DISCORD_OAUTH_REDIRECT_URL | ||
} from '$env/static/public' | ||
|
||
export const getGoogleUrl = (from: string) => { | ||
const rootUrl = `https://accounts.google.com/o/oauth2/v2/auth` | ||
|
||
const options = { | ||
client_id: PUBLIC_GOOGLE_OAUTH_CLIENT_ID, | ||
redirect_uri: PUBLIC_GOOGLE_OAUTH_REDIRECT_URL, | ||
access_type: 'offline', | ||
response_type: 'code', | ||
prompt: 'consent', | ||
scope: [ | ||
'https://www.googleapis.com/auth/userinfo.profile', | ||
'https://www.googleapis.com/auth/userinfo.email' | ||
].join(' '), | ||
state: from | ||
} | ||
|
||
const qs = new URLSearchParams(options) | ||
|
||
return `${rootUrl}?${qs.toString()}` | ||
} | ||
|
||
export const getGitHubUrl = (from: string) => { | ||
const rootURl = 'https://github.com/login/oauth/authorize' | ||
|
||
const options = { | ||
client_id: PUBLIC_GITHUB_OAUTH_CLIENT_ID, | ||
redirect_uri: PUBLIC_GITHUB_OAUTH_REDIRECT_URL, | ||
scope: 'user:email', | ||
state: from | ||
} | ||
|
||
const qs = new URLSearchParams(options) | ||
|
||
return `${rootURl}?${qs.toString()}` | ||
} | ||
|
||
export const getDiscordUrl = (from: string) => { | ||
const rootURl = 'https://discord.com/api/oauth2/authorize' | ||
|
||
const options = { | ||
client_id: PUBLIC_DISCORD_OAUTH_CLIENT_ID, | ||
redirect_uri: PUBLIC_DISCORD_OAUTH_REDIRECT_URL, | ||
scope: 'identify email', | ||
response_type: 'code', | ||
state: from | ||
} | ||
|
||
const qs = new URLSearchParams(options) | ||
|
||
return `${rootURl}?${qs.toString()}` | ||
} | ||
// import { | ||
// PUBLIC_GOOGLE_OAUTH_CLIENT_ID, | ||
// PUBLIC_GOOGLE_OAUTH_REDIRECT_URL, | ||
// PUBLIC_GITHUB_OAUTH_CLIENT_ID, | ||
// PUBLIC_GITHUB_OAUTH_REDIRECT_URL, | ||
// PUBLIC_DISCORD_OAUTH_CLIENT_ID, | ||
// PUBLIC_DISCORD_OAUTH_REDIRECT_URL | ||
// } from '$env/static/public' | ||
|
||
// export const getGoogleUrl = (from: string) => { | ||
// const rootUrl = `https://accounts.google.com/o/oauth2/v2/auth` | ||
|
||
// const options = { | ||
// client_id: PUBLIC_GOOGLE_OAUTH_CLIENT_ID, | ||
// redirect_uri: PUBLIC_GOOGLE_OAUTH_REDIRECT_URL, | ||
// access_type: 'offline', | ||
// response_type: 'code', | ||
// prompt: 'consent', | ||
// scope: [ | ||
// 'https://www.googleapis.com/auth/userinfo.profile', | ||
// 'https://www.googleapis.com/auth/userinfo.email' | ||
// ].join(' '), | ||
// state: from | ||
// } | ||
|
||
// const qs = new URLSearchParams(options) | ||
|
||
// return `${rootUrl}?${qs.toString()}` | ||
// } | ||
|
||
// export const getGitHubUrl = (from: string) => { | ||
// const rootURl = 'https://github.com/login/oauth/authorize' | ||
|
||
// const options = { | ||
// client_id: PUBLIC_GITHUB_OAUTH_CLIENT_ID, | ||
// redirect_uri: PUBLIC_GITHUB_OAUTH_REDIRECT_URL, | ||
// scope: 'user:email', | ||
// state: from | ||
// } | ||
|
||
// const qs = new URLSearchParams(options) | ||
|
||
// return `${rootURl}?${qs.toString()}` | ||
// } | ||
|
||
// export const getDiscordUrl = (from: string) => { | ||
// const rootURl = 'https://discord.com/api/oauth2/authorize' | ||
|
||
// const options = { | ||
// client_id: PUBLIC_DISCORD_OAUTH_CLIENT_ID, | ||
// redirect_uri: PUBLIC_DISCORD_OAUTH_REDIRECT_URL, | ||
// scope: 'identify email', | ||
// response_type: 'code', | ||
// state: from | ||
// } | ||
|
||
// const qs = new URLSearchParams(options) | ||
|
||
// return `${rootURl}?${qs.toString()}` | ||
// } |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { redirect } from '@sveltejs/kit' | ||
|
||
/** @type {import('./$types').LayoutServerLoad} */ | ||
export function load({ locals }) { | ||
if (!locals.user) { | ||
throw redirect(307, '/browse') | ||
} | ||
export function load({ locals }: { locals: any }) { | ||
if (!locals.user) { | ||
throw redirect(307, '/browse') | ||
} | ||
} |
Oops, something went wrong.