Files

39 lines
1.7 KiB
JavaScript

const COLLECTION = "Stackq_Items";
const load = async ({ locals }) => {
const list = await locals.pb.collection(COLLECTION).getFullList({ sort: "-created", expand: "Parent" }).catch(() => []);
const itemsForParent = list.map((i) => ({ id: i.id, Item: i.Item, SKU: i.SKU }));
return { items: list, itemsForParent };
};
const actions = {
setDarkmode: async ({ request, locals }) => {
const user = locals.user;
if (!user) return { success: false };
const formData = await request.formData();
const darkmode = formData.get("darkmode") === "true";
try {
const record = await locals.pb.collection("users").update(user.id, { darkmode });
locals.pb.authStore.save(locals.pb.authStore.token, record);
return { success: true, darkmode };
} catch {
return { success: false };
}
}
};
var _page_server_ts = /*#__PURE__*/Object.freeze({
__proto__: null,
actions: actions,
load: load
});
const index = 2;
let component_cache;
const component = async () => component_cache ??= (await import('./_page.svelte-CGQ867Ip.js')).default;
const server_id = "src/routes/+page.server.ts";
const imports = ["_app/immutable/nodes/2.Ds5Yb8tM.js","_app/immutable/chunks/B5gxx3nr.js","_app/immutable/chunks/DScGFiBY.js","_app/immutable/chunks/BlbL38UD.js","_app/immutable/chunks/Bzak7iHL.js","_app/immutable/chunks/Cua5CQwk.js","_app/immutable/chunks/CcEFwafz.js","_app/immutable/chunks/BPc-JNDc.js","_app/immutable/chunks/BfWekp-4.js","_app/immutable/chunks/BNQ00IGn.js","_app/immutable/chunks/DkOFPg3x.js","_app/immutable/chunks/DoRZqEmo.js"];
const stylesheets = [];
const fonts = [];
export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
//# sourceMappingURL=2-DA-0Vznt.js.map