@@ -20,7 +63,7 @@ export default function RowItem(props: IRowItemProp) {
✓
)}
- {title}
+ {typeof title === 'string' ? title : }
|
);
diff --git a/src/driving/application/core/places-list/infra/PlacesList.tsx b/src/driving/application/core/places-list/infra/PlacesList.tsx
index b3d0422..571b93f 100644
--- a/src/driving/application/core/places-list/infra/PlacesList.tsx
+++ b/src/driving/application/core/places-list/infra/PlacesList.tsx
@@ -1,3 +1,5 @@
+/* eslint-disable consistent-return */
+/* eslint-disable no-underscore-dangle */
import React from 'react';
import getPlaces from '~/business-logic/core/places/get-places';
import getPlacesAdapter from '~/driven/adapters/get-places-adapter/getPlacesAdapter';
@@ -5,10 +7,29 @@ import PlacesModel from '~/business-logic/core/places/common/model/placesModel';
import { prepareStateManagementForVM } from '~/driven/utils/helpers/globalHelpers';
import useGetNavigatorAndTokenUpdater from '~/driven/utils/helpers/hooks/getNavigatorAndAccessTokenUpdator';
import AdminUserModel from '~/business-logic/generic/admin-user/common/data/model/adminUserModel';
+import { apiUrls } from '~/driven/utils/configs/appConfig';
+import { HttpOptionsType } from '~/driven/boundaries/http-boundary/protocols';
+import { HTTPPovider } from '~/driven/boundaries/http-boundary/httpBoundary';
+import { QrPlace } from '~/business-logic/core/places/common/entity/placeEntity';
import PlacesListView from '../view/PlacesListView';
import usePlacesListVM from '../viewmodel/placesListVM';
import placesListModel from '../model/placesListModel';
+type QrCodeResponse = {
+ one_time: false;
+ place_id: string;
+ user_id: string;
+ _id: string;
+}[];
+const QrCodeRO = (response: QrCodeResponse): QrPlace[] => {
+ return response.map((qrCode) => ({
+ id: qrCode._id,
+ oneTime: qrCode.one_time,
+ placeId: qrCode.place_id,
+ userId: qrCode.user_id,
+ }));
+};
+
const prepareTheLogicForModel = () => {
const { accessTokenUpdateHandler, notLoginAuth, userData } = useGetNavigatorAndTokenUpdater();
@@ -26,12 +47,43 @@ export interface IPlacesListProps {
export default function PlacessList(props: IPlacesListProps) {
const { selectedRowId, setSelectedRowId } = props;
- const { getingPlacesLogic, url } = prepareTheLogicForModel();
- const placesModel = async () => await placesListModel(getingPlacesLogic);
+ const { accessTokenUpdateHandler, notLoginAuth, userData } = useGetNavigatorAndTokenUpdater();
+ const getQrCodes = async () => {
+ try {
+ // url
+ const apiUrl = apiUrls.core.getQrs;
+ // options
+ const apiOptions: HttpOptionsType = {
+ url: apiUrl,
+ };
+ // request
+ const userToken = {
+ accessToken: userData.user?.adminUserData.accessToken || null,
+ refreshToken: userData.user?.adminUserData.refreshToken || null,
+ };
+ const httpProvider = new HTTPPovider(userToken, accessTokenUpdateHandler, notLoginAuth);
+ const response = await httpProvider.request