'use strict';

var asyncToGenerator = require('./asyncToGenerator-77821af0.js');
require('./_commonjsHelpers-06173234.js');
require('./core.get-iterator-method-5643aa10.js');
require('./web.dom.iterable-d98303e0.js');
require('./_library-dd23b178.js');
require('./_iter-detect-b1df62f0.js');

var _this = undefined;

var _require = require('@supabase/supabase-js'),
    createClient = _require.createClient;

var SUPABASE_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJvbGUiOiJhbm9uIiwiaWF0IjoxNjQyNjIxNjAyLCJleHAiOjE5NTgxOTc2MDJ9.EkxMVx3xgnzkKAXk7-IRi5rLjKyUmlOE7p49LvYKHvY';
var SUPABASE_URL = "https://mefavzufrirdpagxuxvd.supabase.co";

var supabase = createClient(SUPABASE_URL, SUPABASE_KEY);

var getTIData = function () {
    var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee(tableName, brandName) {
        var _ref2, perData, error;

        return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
            while (1) {
                switch (_context.prev = _context.next) {
                    case 0:
                        _context.next = 2;
                        return supabase.from('' + tableName).select('*').eq('brandName', '' + brandName);

                    case 2:
                        _ref2 = _context.sent;
                        perData = _ref2.data;
                        error = _ref2.error;

                        if (!error) {
                            _context.next = 9;
                            break;
                        }

                        return _context.abrupt('return', {
                            msg: error.message,
                            fail: true
                        });

                    case 9:
                        return _context.abrupt('return', perData);

                    case 10:
                    case 'end':
                        return _context.stop();
                }
            }
        }, _callee, _this);
    }));

    return function getTIData(_x, _x2) {
        return _ref.apply(this, arguments);
    };
}();
module.exports = getTIData;
