22 lines
489 B
JavaScript
22 lines
489 B
JavaScript
import DjangoApi from './django-api';
|
|
import Api from './api';
|
|
|
|
class ApiImplementation {
|
|
constructor() {
|
|
const implementation = import.meta.env.VITE_API_IMPLEMENTATION;
|
|
let apiImplementation;
|
|
if (implementation === 'django') {
|
|
apiImplementation = new DjangoApi();
|
|
} else {
|
|
throw new Error("API implementation don't configured");
|
|
}
|
|
this.api = new Api(apiImplementation);
|
|
}
|
|
|
|
getApi() {
|
|
return this.api;
|
|
}
|
|
}
|
|
|
|
export default ApiImplementation;
|