fix: use apiClient directly instead of window.apiClient in onboarding.js
Fixes JavaScript error "can't access property 'get', window.apiClient is undefined" by following the codebase pattern where apiClient is accessed directly as a global variable rather than via window object. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
14
static/vendor/js/onboarding.js
vendored
14
static/vendor/js/onboarding.js
vendored
@@ -88,7 +88,7 @@ function vendorOnboarding() {
|
||||
this.error = null;
|
||||
|
||||
try {
|
||||
const response = await window.apiClient.get('/api/v1/vendor/onboarding/status');
|
||||
const response = await apiClient.get('/api/v1/vendor/onboarding/status');
|
||||
this.status = response;
|
||||
this.currentStep = response.current_step;
|
||||
this.completedSteps = response.completed_steps_count;
|
||||
@@ -118,12 +118,12 @@ function vendorOnboarding() {
|
||||
async loadStepData() {
|
||||
try {
|
||||
if (this.currentStep === 'company_profile') {
|
||||
const data = await window.apiClient.get('/api/v1/vendor/onboarding/step/company-profile');
|
||||
const data = await apiClient.get('/api/v1/vendor/onboarding/step/company-profile');
|
||||
if (data) {
|
||||
Object.assign(this.formData, data);
|
||||
}
|
||||
} else if (this.currentStep === 'product_import') {
|
||||
const data = await window.apiClient.get('/api/v1/vendor/onboarding/step/product-import');
|
||||
const data = await apiClient.get('/api/v1/vendor/onboarding/step/product-import');
|
||||
if (data) {
|
||||
Object.assign(this.formData, {
|
||||
csv_url_fr: data.csv_url_fr || '',
|
||||
@@ -163,7 +163,7 @@ function vendorOnboarding() {
|
||||
this.connectionError = null;
|
||||
|
||||
try {
|
||||
const response = await window.apiClient.post('/api/v1/vendor/onboarding/step/letzshop-api/test', {
|
||||
const response = await apiClient.post('/api/v1/vendor/onboarding/step/letzshop-api/test', {
|
||||
api_key: this.formData.api_key,
|
||||
shop_slug: this.formData.shop_slug,
|
||||
});
|
||||
@@ -187,7 +187,7 @@ function vendorOnboarding() {
|
||||
this.saving = true;
|
||||
|
||||
try {
|
||||
const response = await window.apiClient.post('/api/v1/vendor/onboarding/step/order-sync/trigger', {
|
||||
const response = await apiClient.post('/api/v1/vendor/onboarding/step/order-sync/trigger', {
|
||||
days_back: parseInt(this.formData.days_back),
|
||||
include_products: true,
|
||||
});
|
||||
@@ -216,7 +216,7 @@ function vendorOnboarding() {
|
||||
// Poll sync progress
|
||||
async pollSyncProgress() {
|
||||
try {
|
||||
const response = await window.apiClient.get(
|
||||
const response = await apiClient.get(
|
||||
`/api/v1/vendor/onboarding/step/order-sync/progress/${this.syncJobId}`
|
||||
);
|
||||
|
||||
@@ -309,7 +309,7 @@ function vendorOnboarding() {
|
||||
break;
|
||||
}
|
||||
|
||||
const response = await window.apiClient.post(endpoint, payload);
|
||||
const response = await apiClient.post(endpoint, payload);
|
||||
|
||||
if (!response.success) {
|
||||
throw new Error(response.message || 'Save failed');
|
||||
|
||||
Reference in New Issue
Block a user