Gerador NIF na APP
This commit is contained in:
33
geradoresfe/src/Api/GeradorApi.tsx
Normal file
33
geradoresfe/src/Api/GeradorApi.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
import axios, { AxiosResponse } from 'axios';
|
||||
|
||||
const API_URL = 'http://localhost:32769/';
|
||||
|
||||
class GeradorService {
|
||||
static async GenerateNIF(type: string | null): Promise<any[]> {
|
||||
try {
|
||||
const response: AxiosResponse = await axios.get(API_URL + 'Generate/GenerateNIF',
|
||||
{
|
||||
params: {
|
||||
type: type
|
||||
}
|
||||
});
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error('Error fetching NIF:', error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
static async GenerateNISS(): Promise<any[]> {
|
||||
try {
|
||||
|
||||
const response: AxiosResponse = await axios.get(API_URL + 'Generate/GenerateNISS');
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error('Error fetching NIF:', error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default GeradorService;
|
||||
Reference in New Issue
Block a user