Skip to content

Commit

Permalink
handle vercel builds
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar committed Oct 10, 2024
1 parent 6e2bad5 commit 639e1bb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ dist-ssr
.aider*

.env
.env.*
package-lock.json
59 changes: 30 additions & 29 deletions src/components/HeaderLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,41 +28,42 @@ export const HeaderLogin: React.FC<HeaderLoginProps> = () => {
if (!isLoggedIn) {
return (
<div className="flex items-center space-x-2 justify-end">
<Button
onClick={() => {
if (!isUsingFakeApi) {
window.location.href = `${snippetsBaseApiUrl}/internal/oauth/github/authorize?next=${window.location.origin}/authorize`
} else {
{isUsingFakeApi ? (
<Button
onClick={() => {
setSession({
account_id: "account-1234",
github_username: "testuser",
token: "1234",
session_id: "session-1234",
})
}
}}
variant="ghost"
size="sm"
>
Login
</Button>
<Button
size="sm"
onClick={() => {
if (!isUsingFakeApi) {
window.location.href = `${snippetsBaseApiUrl}/internal/oauth/github/authorize?next=${window.location.origin}/authorize`
} else {
setSession({
account_id: "account-1234",
github_username: "testuser",
token: "1234",
session_id: "session-1234",
})
}
}}
>
Sign Up
</Button>
}}
variant="ghost"
size="sm"
>
Fake testuser Login
</Button>
) : (
<div>
<Button
onClick={() => {
window.location.href = `${snippetsBaseApiUrl}/internal/oauth/github/authorize?next=${window.location.origin}/authorize`
}}
variant="ghost"
size="sm"
>
Login
</Button>
<Button
size="sm"
onClick={() => {
window.location.href = `${snippetsBaseApiUrl}/internal/oauth/github/authorize?next=${window.location.origin}/authorize`
}}
>
Sign Up
</Button>
</div>
)}
</div>
)
}
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function apiFakePlugin(): Plugin {

let plugins: any[] = [react()]
let proxy: any = undefined
if (!process.env.SNIPPETS_API_URL) {
if (!process.env.SNIPPETS_API_URL && !process.env.VERCEL) {
process.env.VITE_USE_FAKE_API = "true"
console.log("Using fake snippets API (see ./fake-snippets-api)")
plugins.push(apiFakePlugin())
Expand Down

0 comments on commit 639e1bb

Please sign in to comment.