Many Changes

This commit is contained in:
2024-05-14 12:49:50 +02:00
parent a01b6bdbc2
commit f6eef1ded3
53 changed files with 636 additions and 579 deletions
+11 -5
View File
@@ -1,13 +1,10 @@
'use server'
import { Model } from "sequelize";
import { cookies } from "next/headers";
import { Auth, Post, User } from "@/model/sequelize/NewModels";
import { APIError} from "@/api/error"
import { UserAuth, parseBasicAuth, getAssociatedUser } from "@/api/user"
import { Auth, User } from "@/model/Models";
async function tryAuth(request:Request){
@@ -31,15 +28,24 @@ async function tryAuth(request:Request){
user_id: user.id,
})
console.log('ok');
const foundAuth = await Auth.findOne({
include: 'user',
include: {
model: User,
as: 'user'
},
where: {
user_id: user.id
}
})
console.log('ok2');
if(!foundAuth)
return new Response("error",{status:500});
const usr = foundAuth.user;
const authUser = await authentication.getUser();