fix: brew machine cannot show value

Signed-off-by: pakintada@gmail.com <Pakin>
This commit is contained in:
pakintada@gmail.com 2026-03-16 17:17:12 +07:00
parent e6d1ac9a99
commit ee57dd1163
6 changed files with 43 additions and 8 deletions

View file

@ -4,6 +4,8 @@ import { sendMessage } from '../handlers/ws_messageSender';
import { auth } from '../stores/auth';
import { extractCookieOnNonBrowser } from '$lib/helpers/cookie';
import { browser } from '$app/environment';
import { permission } from '../stores/permissions';
import { addNotification } from '../stores/noti';
export async function getRecipes() {
if (browser && !get(departmentStore)) {
@ -14,6 +16,14 @@ export async function getRecipes() {
let countryTarget = get(departmentStore);
let country = '';
let countryPerm = `document.read.${countryTarget}`;
let user_perms = get(permission);
if (!user_perms.includes(countryPerm)) {
addNotification('ERR:Invalid permission');
return [];
}
// if (!countryTarget && !browser) {
// countryTarget = extractCookieOnNonBrowser()['department'];
// }

View file

@ -20,6 +20,8 @@ export const materialData = writable<Material | undefined>();
export const recipeFromMachine = writable<any>(null);
export const recipeFromMachineLoading = writable(false);
export const recipeFromMachineError = writable<string | null>(null);
export const toppingListFromMachineQuery = writable<any>([]);
export const toppingGroupFromMachineQuery = writable<any>([]);
export const recipeFromServerQuery = writable<any>({});
export const materialFromServerQuery = writable<any>([]);