UNPKG

ggez-banking-sdk

Version:

A Node.js package to handle GGEZ Banking API endpoints, Simplify the process of managing CRUD operations with this efficient and easy-to-use package.

46 lines (45 loc) 1.69 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.useGetUserLatest = void 0; const restApi_1 = __importDefault(require("../restApi")); const helper_1 = __importDefault(require("../helper")); const useGetUserLatest = (token, userInfo, userId, baseUrl, lang) => { const { checkResponse, headerConfig } = (0, helper_1.default)(userInfo); const { checkGlobalResponse } = checkResponse(); let endPointAccount = `V1/user/history/latest`; const GetLatestByUserId = async () => { try { let endPoint = `${endPointAccount}/${userId}`; let headersData = { header: true, isUrlEncoded: false, token: token, lang: lang, }; let headers = headerConfig(headersData); const response = await restApi_1.default.restApi(baseUrl, "GET", endPoint, headers); checkGlobalResponse("history", response, "GetLatestByUserId"); return { response: response, newUser: {}, message: response?.data?.result?.message ?? "Get User latest Successfully", status: "success", }; } catch (error) { return { response: error.response, newUser: null, message: error.message, status: "failed", }; } }; return { GetLatestByUserId, }; }; exports.useGetUserLatest = useGetUserLatest;