Boa noite, tudo bem ?
No Angular, fiz este código para listar as order. Mas dá erro de CORS. O que pode ser ? Como ajustar ?
Good evening, how are you?
In Angular, I made this code to list the order. But it gives CORS error. What can it be ? How to adjust?
async wix(): Promise<void> {
const wixClient = createClient({
modules: { orders },
auth: ApiKeyStrategy({
siteId: "00000000000000000",
apiKey: "000000000000",
}),
});
console.log("wixClient");
console.log(wixClient);
const response = await wixClient.orders.listOrders();
console.log("response");
console.log(response);
}
From the error it appears that siteId
is not allowed in this request. Can you check if that’s the issue?
Also can you provide the full piece of code causing the issue including the imports?
Projeto em angular
Angular project
"dependencies": {
"@angular/animations": "^16.0.0",
"@angular/cdk": "^16.0.0",
"@angular/common": "^16.0.0",
"@angular/compiler": "^16.0.0",
"@angular/core": "^16.0.0",
"@angular/forms": "^16.0.0",
"@angular/material": "^16.0.0",
"@angular/material-moment-adapter": "^16.2.6",
"@angular/platform-browser": "^16.0.0",
"@angular/platform-browser-dynamic": "^16.0.0",
"@angular/router": "^16.0.0",
"@wix/events": "^1.0.145",
"@wix/sdk": "^1.7.4",
}
Como está sendo chamado o wix
What is wix being called
import { createClient, ApiKeyStrategy } from "@wix/sdk";
import { orders } from "@wix/events";
async wix(): Promise<void> {
const wixClient = createClient({
modules: { orders },
auth: ApiKeyStrategy({
siteId: "xxxxxxxxxxxxxxx",
apiKey: "xxxxxxxxxxxxx",
}),
});
console.log("wixClient");
console.log(wixClient);
const response = await wixClient.orders.listOrders();
console.log("response");
console.log(response);
}