mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-07 20:44:05 +09:00
fix: issues
This commit is contained in:
1 parent
95f23b9dbc
commit
bf50e50e95
1 file changed
+5
-6
@@ -1,8 +1,7 @@
|
||||
import { type LoaderFunction, redirect } from "@remix-run/node";
|
||||
import type { User } from "@webstudio-is/prisma-client";
|
||||
import { db as database } from "@webstudio-is/project";
|
||||
import type { Project } from "@webstudio-is/project";
|
||||
import * as db from "~/shared/db";
|
||||
import { db as projectDb, type Project } from "@webstudio-is/project";
|
||||
import * as userDb from "~/shared/db";
|
||||
import { ensureUserCookie } from "~/shared/session";
|
||||
import config from "~/config";
|
||||
import { authenticator } from "~/services/auth.server";
|
||||
@@ -14,10 +13,10 @@ const ensureProject = async ({
|
||||
userId: User["id"];
|
||||
domain: string;
|
||||
}): Promise<Project> => {
|
||||
const projects = await database.project.loadManyByUserId(userId);
|
||||
const projects = await projectDb.project.loadManyByUserId(userId);
|
||||
if (projects.length !== 0) return projects[0];
|
||||
|
||||
return await database.project.clone(domain, userId);
|
||||
return await projectDb.project.clone(domain, userId);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -33,7 +32,7 @@ export const loader: LoaderFunction = async ({ request, params }) => {
|
||||
const user = await authenticator.isAuthenticated(request);
|
||||
const { headers, userId: generatedUserId } = await ensureUserCookie(request);
|
||||
try {
|
||||
const userId = await db.user.ensureUser({
|
||||
const userId = await userDb.user.ensureUser({
|
||||
userId: user ? user.id : generatedUserId,
|
||||
});
|
||||
const project = await ensureProject({
|
||||
|
||||
Reference in new issue
Block a user