This commit is contained in:
pakintada@gmail.com 2026-02-17 14:30:02 +07:00
commit 451223816b
338 changed files with 9938 additions and 0 deletions

View file

@ -0,0 +1,38 @@
import { get } from 'svelte/store';
import { departmentStore } from '../stores/departments';
import { sendMessage } from '../handlers/ws_messageSender';
import { auth } from '../stores/auth';
import { extractCookieOnNonBrowser } from '$lib/helpers/cookie';
import { browser } from '$app/environment';
export async function getRecipes() {
if (browser && !get(departmentStore)) {
console.log('cannot get dep', get(departmentStore));
return [];
}
let countryTarget = get(departmentStore);
let country = '';
// if (!countryTarget && !browser) {
// countryTarget = extractCookieOnNonBrowser()['department'];
// }
// construct path. fetch (GET) {server}/recipe/{countryTarget}/{version}
let idToken = await get(auth)?.getIdToken();
console.log('country target get recipe', country);
sendMessage({
type: 'recipe',
payload: {
auth: idToken ?? '',
partial: false,
country: countryTarget ?? '',
version: -1,
parameters: ''
}
});
return [];
}