-
-
Notifications
You must be signed in to change notification settings - Fork 807
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "feat: upgrade tanstack query to v5 (#4360)"
This reverts commit ce1a603.
- Loading branch information
1 parent
ce1a603
commit bddc1d8
Showing
65 changed files
with
421 additions
and
538 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { api } from "src/blitz-server" | ||
import GithubProvider from "next-auth/providers/github" | ||
import EmailProvider from "next-auth/providers/email" | ||
import { NextAuthAdapter, BlitzNextAuthOptions } from "@blitzjs/auth/next-auth" | ||
import db, { User } from "db" | ||
import { Role } from "types" | ||
|
||
// Has to be defined separately for `profile` to be correctly typed below | ||
const providers = [ | ||
GithubProvider({ | ||
clientId: process.env.GITHUB_CLIENT_ID as string, | ||
clientSecret: process.env.GITHUB_CLIENT_SECRET as string, | ||
}), | ||
EmailProvider({ | ||
from: process.env.GITHUB_CLIENT_ID as string, | ||
server: process.env.GITHUB_CLIENT_SECRET as string, | ||
}), | ||
] | ||
|
||
export default api( | ||
NextAuthAdapter({ | ||
successRedirectUrl: "/", | ||
errorRedirectUrl: "/error", | ||
providers, | ||
callback: async (user, account, profile, session) => { | ||
console.log("USER SIDE PROFILE_DATA", { user, account, profile }) | ||
let newUser: User | ||
try { | ||
newUser = await db.user.findFirstOrThrow({ where: { name: { equals: user.name } } }) | ||
} catch (e) { | ||
newUser = await db.user.create({ | ||
data: { | ||
email: user.email as string, | ||
name: user.name as string, | ||
role: "USER", | ||
}, | ||
}) | ||
} | ||
const publicData = { | ||
userId: newUser.id, | ||
role: newUser.role as Role, | ||
source: "github", | ||
} | ||
await session.$create(publicData) | ||
return { redirectUrl: "/" } | ||
}, | ||
}) | ||
) |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import {passportAuth} from "@blitzjs/auth" | ||
import {api} from "src/blitz-server" | ||
import db from "db" | ||
import {Strategy as TwitterStrategy} from "passport-twitter" | ||
|
||
export default api( | ||
passportAuth({ | ||
successRedirectUrl: "/", | ||
errorRedirectUrl: "/", | ||
strategies: [ | ||
{ | ||
strategy: new TwitterStrategy( | ||
{ | ||
consumerKey: process.env.TWITTER_CONSUMER_KEY as string, | ||
consumerSecret: process.env.TWITTER_CONSUMER_SECRET as string, | ||
accessTokenURL: "https://api.twitter.com/oauth/access_token", | ||
callbackURL: "http://127.0.0.1:3000/api/auth/twitter/callback", | ||
includeEmail: true, | ||
}, | ||
async function (_token, _tokenSecret, profile, done) { | ||
const email = profile.emails?.[0]?.value ?? "[email protected]" | ||
|
||
const user = await db.user.upsert({ | ||
where: {email}, | ||
create: { | ||
email, | ||
name: profile.displayName, | ||
}, | ||
update: {email}, | ||
}) | ||
|
||
const publicData = { | ||
userId: user.id, | ||
roles: [user.role], | ||
source: "twitter", | ||
} | ||
|
||
done(undefined, {publicData}) | ||
}, | ||
), | ||
}, | ||
], | ||
}), | ||
) |
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
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
4 changes: 2 additions & 2 deletions
4
integration-tests/auth-with-rpc/src/pages/layout-authenticate-redirect.tsx
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
4 changes: 2 additions & 2 deletions
4
integration-tests/auth-with-rpc/src/pages/page-dot-authenticate-redirect.tsx
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
4 changes: 2 additions & 2 deletions
4
integration-tests/auth-with-rpc/src/pages/page-dot-authenticate-role-redirect-stay.tsx
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
4 changes: 2 additions & 2 deletions
4
integration-tests/auth-with-rpc/src/pages/page-dot-authenticate-role-redirect.tsx
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
Oops, something went wrong.