Skip to content

Commit

Permalink
Code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
bartwr committed Mar 30, 2024
1 parent 8e83267 commit fba44aa
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 38 deletions.
4 changes: 2 additions & 2 deletions src/components/FooterNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ const FooterNav = ({ onStallingAanmelden, children }: {
{!session ?
<FooterNavItemClick
onClick={() => { onStallingAanmelden && onStallingAanmelden() }}
className="font-bold">
Stalling Aanmelden
className="cursor-pointer font-bold">
Stalling aanmelden
</FooterNavItemClick> : null}

{navItemsPrimary.map(x => <FooterNavItem
Expand Down
2 changes: 0 additions & 2 deletions src/components/ParkingFacilityBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ function ParkingFacilityBrowser({
mapZoom >= 12 &&
(filterQuery && filterQuery.length > 0)
) {
console.log('filtered', filtered)
filtered = filtered.filter((p) => {
const titleIndex = p.Title?.toLowerCase().indexOf(filterQuery.toLowerCase())
const locationIndex = p.Location?.toLowerCase().indexOf(filterQuery.toLowerCase())
Expand All @@ -173,7 +172,6 @@ function ParkingFacilityBrowser({

// Decide if we want to show the parking
let showParking = inFilter;
console.log('showParking', showParking)

return showParking;
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/parking/ParkingEditCapaciteit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const getAllowedValueForFietstype = (fietstypeName: string, capacitydata: capaci

const toggleActive = (fietsenstalling_secties: ParkingSections, fietstypeName: string, isActive: boolean): ParkingSections => {
// It's mandatory to have at least 1 section
if (!fietsenstalling_secties[0]) return fietsenstalling_secties;
if (!fietsenstalling_secties || !fietsenstalling_secties[0]) return fietsenstalling_secties;
if (!fietsenstalling_secties[0].secties_fietstype) return fietsenstalling_secties;

let didUpdateSomething = false;
Expand Down
46 changes: 23 additions & 23 deletions src/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { prisma } from "~/server/db";

import type { Provider } from "next-auth/providers";
import NextAuth from "next-auth";
import { PrismaAdapter } from "@auth/prisma-adapter"
// import { PrismaAdapter } from "@auth/prisma-adapter"

import type { NextAuthOptions, User } from "next-auth";
import EmailProvider from "next-auth/providers/email"
// import EmailProvider from "next-auth/providers/email"

import CredentialsProvider from "next-auth/providers/credentials";

Expand Down Expand Up @@ -44,31 +44,31 @@ providers.push(
return user;
},
}),
EmailProvider({
name: "Magic link",
server: {
host: process.env.EMAIL_SERVER_HOST,
port: process.env.EMAIL_SERVER_PORT,
auth: {
user: process.env.EMAIL_SERVER_USER,
pass: process.env.EMAIL_SERVER_PASSWORD
}
},
from: process.env.EMAIL_FROM,
maxAge: 60 * 60, // 1 hour
// sendVerificationRequest({
// identifier: email,
// url,
// provider: { server, from }
// }) {
// /* your function */
// }
})
// EmailProvider({
// name: "Magic link",
// server: {
// host: process.env.EMAIL_SERVER_HOST,
// port: process.env.EMAIL_SERVER_PORT,
// auth: {
// user: process.env.EMAIL_SERVER_USER,
// pass: process.env.EMAIL_SERVER_PASSWORD
// }
// },
// from: process.env.EMAIL_FROM,
// maxAge: 60 * 60, // 1 hour
// // sendVerificationRequest({
// // identifier: email,
// // url,
// // provider: { server, from }
// // }) {
// // /* your function */
// // }
// })
);

export const authOptions: NextAuthOptions = {
providers,
adapter: PrismaAdapter(prisma),
// adapter: PrismaAdapter(prisma),
// https://next-auth.js.org/configuration/callbacks
callbacks: {
// augment jwt token with information that will be used on the server side
Expand Down
18 changes: 9 additions & 9 deletions src/pages/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ const Login: NextPage = () => {
emailRef.current && emailRef.current.value !== '' &&
passwordRef.current && passwordRef.current.value !== ''
) {
console.log('signing in with magic link')
signIn("email", {
email: emailRef.current.value.trim(),
// password: passwordRef.current.value,
// callbackUrl: "/",
});
// signIn("credentials", {
// console.log('signing in with magic link')
// signIn("email", {
// email: emailRef.current.value.trim(),
// password: passwordRef.current.value,
// callbackUrl: "/",
// // password: passwordRef.current.value,
// // callbackUrl: "/",
// });
signIn("credentials", {
email: emailRef.current.value.trim(),
password: passwordRef.current.value,
callbackUrl: "/",
});
} else {
alert('no email of password given');
}
Expand Down
2 changes: 1 addition & 1 deletion src/store/mapSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const mapSlice = createSlice({
},
// Set activeParkingId
setActiveParkingId(state, action) {
console.log('setActiveParkingId', action.payload);
// console.log('setActiveParkingId', action.payload);
state.activeParkingId = action.payload;
},
// setActiveMunicipality
Expand Down

0 comments on commit fba44aa

Please sign in to comment.