fetch-sveltekit
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -1,2 +0,2 @@ | ||
export declare const EMethodeFetch: () => { | ||
export declare const methodeFetch: () => { | ||
POST: string; | ||
@@ -26,4 +26,13 @@ PUT: string; | ||
* @param data => les données à envoyer | ||
* @returns | ||
* @returns les données en JSON | ||
*/ | ||
export declare const callApi: <T>(url: string, method: string, data?: any, header?: HeadersInit) => Promise<T>; | ||
export declare const callApiJson: <T>(url: string, method: string, data?: any, header?: HeadersInit) => Promise<T>; | ||
/** | ||
* fonction qui créer un request universel qui sera déterminé par les parametre | ||
* @param url => url de la request | ||
* @param method => la methode "post" , "get" etc ... utiliser les enum | ||
* @param header => header de la request utiliser les fonctions fournis par le service | ||
* @param data => les données à envoyer | ||
* @returns les données en BRUT | ||
*/ | ||
export declare const callApi: (url: string, method: string, data?: any, header?: HeadersInit) => Promise<any>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.callApi = exports.configRequest = exports.headersSample = exports.EMethodeFetch = void 0; | ||
const EMethodeFetch = () => { | ||
exports.callApi = exports.callApiJson = exports.configRequest = exports.headersSample = exports.methodeFetch = void 0; | ||
const methodeFetch = () => { | ||
return { | ||
@@ -13,3 +13,3 @@ POST: 'POST', | ||
}; | ||
exports.EMethodeFetch = EMethodeFetch; | ||
exports.methodeFetch = methodeFetch; | ||
/** | ||
@@ -64,8 +64,21 @@ * fonction qui creer et retourne un headers simple | ||
* @param data => les données à envoyer | ||
* @returns | ||
* @returns les données en JSON | ||
*/ | ||
const callApi = async (url, method, data, header = {}) => { | ||
const callApiJson = async (url, method, data, header = {}) => { | ||
const response = await (await fetch(url, (0, exports.configRequest)(method, header, data))).json(); | ||
return response; | ||
}; | ||
exports.callApiJson = callApiJson; | ||
/** | ||
* fonction qui créer un request universel qui sera déterminé par les parametre | ||
* @param url => url de la request | ||
* @param method => la methode "post" , "get" etc ... utiliser les enum | ||
* @param header => header de la request utiliser les fonctions fournis par le service | ||
* @param data => les données à envoyer | ||
* @returns les données en BRUT | ||
*/ | ||
const callApi = async (url, method, data, header = {}) => { | ||
const response = await fetch(url, (0, exports.configRequest)(method, header, data)); | ||
return response; | ||
}; | ||
exports.callApi = callApi; |
@@ -1,1 +0,1 @@ | ||
export { callApi, configRequest, headersSample, EMethodeFetch, } from './fetch-service'; | ||
export { callApi, callApiJson, configRequest, headersSample, methodeFetch, } from './fetch-service'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EMethodeFetch = exports.headersSample = exports.configRequest = exports.callApi = void 0; | ||
exports.methodeFetch = exports.headersSample = exports.configRequest = exports.callApiJson = exports.callApi = void 0; | ||
var fetch_service_1 = require("./fetch-service"); | ||
Object.defineProperty(exports, "callApi", { enumerable: true, get: function () { return fetch_service_1.callApi; } }); | ||
Object.defineProperty(exports, "callApiJson", { enumerable: true, get: function () { return fetch_service_1.callApiJson; } }); | ||
Object.defineProperty(exports, "configRequest", { enumerable: true, get: function () { return fetch_service_1.configRequest; } }); | ||
Object.defineProperty(exports, "headersSample", { enumerable: true, get: function () { return fetch_service_1.headersSample; } }); | ||
Object.defineProperty(exports, "EMethodeFetch", { enumerable: true, get: function () { return fetch_service_1.EMethodeFetch; } }); | ||
Object.defineProperty(exports, "methodeFetch", { enumerable: true, get: function () { return fetch_service_1.methodeFetch; } }); |
@@ -1,2 +0,2 @@ | ||
export declare const EMethodeFetch: () => { | ||
export declare const methodeFetch: () => { | ||
POST: string; | ||
@@ -26,4 +26,13 @@ PUT: string; | ||
* @param data => les données à envoyer | ||
* @returns | ||
* @returns les données en JSON | ||
*/ | ||
export declare const callApi: <T>(url: string, method: string, data?: any, header?: HeadersInit) => Promise<T>; | ||
export declare const callApiJson: <T>(url: string, method: string, data?: any, header?: HeadersInit) => Promise<T>; | ||
/** | ||
* fonction qui créer un request universel qui sera déterminé par les parametre | ||
* @param url => url de la request | ||
* @param method => la methode "post" , "get" etc ... utiliser les enum | ||
* @param header => header de la request utiliser les fonctions fournis par le service | ||
* @param data => les données à envoyer | ||
* @returns les données en BRUT | ||
*/ | ||
export declare const callApi: (url: string, method: string, data?: any, header?: HeadersInit) => Promise<any>; |
@@ -1,2 +0,2 @@ | ||
export const EMethodeFetch = () => { | ||
export const methodeFetch = () => { | ||
return { | ||
@@ -57,7 +57,19 @@ POST: 'POST', | ||
* @param data => les données à envoyer | ||
* @returns | ||
* @returns les données en JSON | ||
*/ | ||
export const callApi = async (url, method, data, header = {}) => { | ||
export const callApiJson = async (url, method, data, header = {}) => { | ||
const response = await (await fetch(url, configRequest(method, header, data))).json(); | ||
return response; | ||
}; | ||
/** | ||
* fonction qui créer un request universel qui sera déterminé par les parametre | ||
* @param url => url de la request | ||
* @param method => la methode "post" , "get" etc ... utiliser les enum | ||
* @param header => header de la request utiliser les fonctions fournis par le service | ||
* @param data => les données à envoyer | ||
* @returns les données en BRUT | ||
*/ | ||
export const callApi = async (url, method, data, header = {}) => { | ||
const response = await fetch(url, configRequest(method, header, data)); | ||
return response; | ||
}; |
@@ -1,1 +0,1 @@ | ||
export { callApi, configRequest, headersSample, EMethodeFetch, } from './fetch-service'; | ||
export { callApi, callApiJson, configRequest, headersSample, methodeFetch, } from './fetch-service'; |
@@ -1,1 +0,1 @@ | ||
export { callApi, configRequest, headersSample, EMethodeFetch, } from './fetch-service'; | ||
export { callApi, callApiJson, configRequest, headersSample, methodeFetch, } from './fetch-service'; |
{ | ||
"name": "fetch-sveltekit", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "fonction de requête API", | ||
@@ -27,5 +27,2 @@ "repository": { | ||
"devDependencies": { | ||
"@types/cookie": "^0.4.1", | ||
"@types/crypto-js": "^4.1.0", | ||
"@types/jsonwebtoken": "^8.5.8", | ||
"typescript": "^4.5.4", | ||
@@ -40,3 +37,3 @@ "rimraf": "^3.0.2" | ||
"author": "woopear <woopears@gmail.com>", | ||
"license": "ISC" | ||
"license": "MIT" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
29344
2
17
401
4