refire-client
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -15,3 +15,6 @@ "use strict"; | ||
constructor(apiKey, apiUrl = "https://refire.email/api") { | ||
this.apiKey = apiKey; // Now required | ||
if (!apiKey) { | ||
throw new Error('API key is required'); | ||
} | ||
this.apiKey = apiKey; | ||
this.apiUrl = apiUrl; | ||
@@ -21,11 +24,10 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const headers = { | ||
"Content-Type": "application/json", | ||
"x-api-key": this.apiKey, | ||
}; | ||
const response = yield fetch(`${this.apiUrl}/send-email`, { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify({ | ||
apiKey: this.apiKey, | ||
data: params, | ||
}), | ||
headers, | ||
body: JSON.stringify(params), | ||
}); | ||
@@ -44,7 +46,7 @@ if (!response.ok) { | ||
"Content-Type": "application/json", | ||
"x-api-key": this.apiKey, | ||
}, | ||
body: JSON.stringify({ | ||
apiKey: this.apiKey, | ||
templateId: params.templateId, | ||
data: params.data, | ||
to: params.to, | ||
}), | ||
@@ -51,0 +53,0 @@ }); |
{ | ||
"name": "refire-client", | ||
"version": "0.1.0", | ||
"description": "", | ||
"version": "0.1.1", | ||
"description": "Refire Email API Client", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
5996
3
58
1
135