|
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 | |
|---|
| 1 | import {GetRestourant} from "../services/restoran-service";
|
|---|
| 2 | import {GetActiveOrder} from "../services/order-service";
|
|---|
| 3 | import {UserRole} from "../services/user-service";
|
|---|
| 4 |
|
|---|
| 5 | export 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.