fix(web): token not being saved
This commit is contained in:
@@ -68,6 +68,11 @@ export const createRun = withServerPromise(
|
||||
},
|
||||
};
|
||||
console.log(data);
|
||||
|
||||
if (!machine.auth_token) {
|
||||
throw new Error("Machine auth token not found");
|
||||
}
|
||||
|
||||
const __result = await fetch(`${machine.endpoint}/run`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
||||
@@ -23,15 +23,13 @@ export async function getMachines() {
|
||||
}
|
||||
|
||||
export const addMachine = withServerPromise(
|
||||
async ({ name, endpoint, type }: z.infer<typeof addMachineSchema>) => {
|
||||
async (data: z.infer<typeof addMachineSchema>) => {
|
||||
const { userId } = auth();
|
||||
if (!userId) return { error: "No user id" };
|
||||
console.log(name, endpoint);
|
||||
// console.log(name, endpoint);
|
||||
await db.insert(machinesTable).values({
|
||||
...data,
|
||||
user_id: userId,
|
||||
name,
|
||||
endpoint,
|
||||
type,
|
||||
});
|
||||
revalidatePath("/machines");
|
||||
return { message: "Machine Added" };
|
||||
|
||||
Reference in New Issue
Block a user