source: frontend/src/loaders/restourant-loader.jsx@ badbc79

Last change on this file since badbc79 was badbc79, checked in by Luka Cheshlarov <luka.cheshlarov@…>, 20 months ago

Initial commit

  • Property mode set to 100644
File size: 636 bytes
Line 
1import {GetRestourant} from "../services/restoran-service";
2import {GetActiveOrder} from "../services/order-service";
3import {UserRole} from "../services/user-service";
4
5export const restorantLoader = async ({request, loggedUserRole, ownershipChanges}) => {
6 const restorant = await GetRestourant(request.params.restorantId);
7 let activeOrder = null
8
9 if (loggedUserRole?.role === UserRole.Potrosuvac && loggedUserRole?.activeOwnershipId) {
10 activeOrder = await GetActiveOrder(loggedUserRole.roleId)
11
12 if (!activeOrder) {
13 ownershipChanges(null);
14 }
15 }
16
17 return {restorant, activeOrder};
18}
Note: See TracBrowser for help on using the repository browser.