Remove Olist connection control from registrations
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m22s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m22s
This commit is contained in:
@@ -1,13 +1,12 @@
|
|||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { Link, useSearchParams } from 'react-router-dom';
|
import { Link, useSearchParams } from 'react-router-dom';
|
||||||
import { ClipboardList, CloudDownload, Link2, Loader2, Package, Pencil, RefreshCw, Ruler, Save, Tags, Trash2, Upload } from 'lucide-react';
|
import { ClipboardList, CloudDownload, Loader2, Package, Pencil, RefreshCw, Ruler, Save, Tags, Trash2, Upload } from 'lucide-react';
|
||||||
import {
|
import {
|
||||||
deleteCatalogCategory,
|
deleteCatalogCategory,
|
||||||
deleteCatalogProduct,
|
deleteCatalogProduct,
|
||||||
deleteConsumptionReference,
|
deleteConsumptionReference,
|
||||||
fetchCatalogSummary,
|
fetchCatalogSummary,
|
||||||
fetchOlistStatus,
|
fetchOlistStatus,
|
||||||
getOlistAuthorizationUrl,
|
|
||||||
importProductCompositions,
|
importProductCompositions,
|
||||||
isSuperAdmin,
|
isSuperAdmin,
|
||||||
saveCatalogCategory,
|
saveCatalogCategory,
|
||||||
@@ -415,17 +414,6 @@ const Registrations = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const connectOlist = async () => {
|
|
||||||
setOlistActionLoading(true);
|
|
||||||
try {
|
|
||||||
window.location.assign(await getOlistAuthorizationUrl());
|
|
||||||
} catch (error) {
|
|
||||||
setFeedback(error instanceof Error ? error.message : 'Não foi possível iniciar a conexão com a Olist.');
|
|
||||||
setStatus('error');
|
|
||||||
setOlistActionLoading(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const syncOlist = async () => {
|
const syncOlist = async () => {
|
||||||
setOlistActionLoading(true);
|
setOlistActionLoading(true);
|
||||||
try {
|
try {
|
||||||
@@ -506,18 +494,7 @@ const Registrations = () => {
|
|||||||
{olistActionLoading || olistStatus.syncInProgress ? <Loader2 className="h-4 w-4 animate-spin" /> : <CloudDownload className="h-4 w-4" />}
|
{olistActionLoading || olistStatus.syncInProgress ? <Loader2 className="h-4 w-4 animate-spin" /> : <CloudDownload className="h-4 w-4" />}
|
||||||
{olistStatus.syncInProgress ? 'Sincronizando' : 'Sincronizar Olist'}
|
{olistStatus.syncInProgress ? 'Sincronizando' : 'Sincronizar Olist'}
|
||||||
</button>
|
</button>
|
||||||
) : (
|
) : null}
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => void connectOlist()}
|
|
||||||
disabled={!olistStatus.configured || olistActionLoading}
|
|
||||||
title={olistStatus.configured ? 'Conectar conta Olist' : 'Configure as credenciais Olist V3 no ambiente'}
|
|
||||||
className="inline-flex h-10 items-center justify-center gap-2 rounded-xl border border-dark-border bg-dark-card px-4 text-sm font-bold text-dark-text transition-colors hover:border-brand-primary disabled:cursor-not-allowed disabled:opacity-60 cursor-pointer"
|
|
||||||
>
|
|
||||||
{olistActionLoading ? <Loader2 className="h-4 w-4 animate-spin" /> : <Link2 className="h-4 w-4 text-brand-primary" />}
|
|
||||||
Conectar Olist
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<input
|
<input
|
||||||
|
|||||||
Reference in New Issue
Block a user