@@ -3,7 +3,6 @@ import prisma from '$lib/prisma'
33
44import { redirect } from '@sveltejs/kit' ;
55import { env } from '$env/dynamic/private' ;
6- import { auth } from '$lib/stores/auth' ;
76
87// import bcrypt from "bcryptjs";
98import { v4 as uuidv4 } from 'uuid' ;
@@ -26,13 +25,13 @@ async function fetchUserData(params) {
2625}
2726
2827/** @type {import('@sveltejs/kit').ServerLoad } */
29- export async function load ( { params , url, cookies } ) {
28+ export async function load ( { url, cookies } ) {
3029 const code = url . searchParams . get ( 'code' )
3130 const redirect_uri = env . GOOGLE_LOGIN_DOMAIN + '/login'
3231
3332 // Check if the user is already authenticated
3433 if ( code != null ) {
35- params = {
34+ const tokenParams = {
3635 grant_type : 'authorization_code' ,
3736 code,
3837 redirect_uri,
@@ -42,7 +41,7 @@ export async function load({ params, url, cookies }) {
4241 let info
4342
4443 try {
45- const response = await axios . post ( 'https://accounts.google.com/o/oauth2/token' , params )
44+ const response = await axios . post ( 'https://accounts.google.com/o/oauth2/token' , tokenParams )
4645 info = response . data
4746 } catch ( error ) {
4847 console . error ( 'Error:' , error )
@@ -52,7 +51,7 @@ export async function load({ params, url, cookies }) {
5251
5352 const session_id = uuidv4 ( )
5453
55- const user = await prisma . user . upsert ( {
54+ await prisma . user . upsert ( {
5655 where : { email : user_info . email } ,
5756 update : {
5857 session_id : session_id ,
0 commit comments