mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
video merge
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MiddlewareServiceService } from "src/app/shared/API/middleware/middleware-service.service";
|
||||
import { CMAPIAPIService } from "src/app/shared/API/CMAPI/cmapi-api.service";
|
||||
import { ok, err } from 'neverthrow';
|
||||
import { ok, err, Result } from 'neverthrow';
|
||||
import { Observable } from 'rxjs';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { IuploadFileLK } from '../../API/middleware/interface';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -15,16 +17,38 @@ export class CMAPIService {
|
||||
window["CMAPIAPIRepository"] = this
|
||||
}
|
||||
|
||||
async FileContent({length, path, index, blobFile}) {
|
||||
|
||||
async FileContent({length, path, index, blobFile}): Promise<Result<IuploadFileLK, "badRequest" | "other">> {
|
||||
try {
|
||||
const result = await this.MiddlewareServiceService.CMAPIFileContent({length, path, index, blobFile}).toPromise();
|
||||
return ok(result)
|
||||
} catch (error) {
|
||||
if(error.status >= 400 && error.status >= 499) {
|
||||
return err("badRequest")
|
||||
}
|
||||
|
||||
return err("other")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async RequestUpload(): Promise<Result<string, any>> {
|
||||
try {
|
||||
const result = await this.MiddlewareServiceService.CMAPIRequestUpload().toPromise();
|
||||
return ok(result)
|
||||
|
||||
} catch (error) {
|
||||
return err(error)
|
||||
}
|
||||
}
|
||||
|
||||
async UploadStatus() {
|
||||
try {
|
||||
const result = await this.MiddlewareServiceService.CMAPIUploadStatus().toPromise();
|
||||
return ok(result)
|
||||
|
||||
} catch (error) {
|
||||
return err(error)
|
||||
}
|
||||
}
|
||||
|
||||
async ping() {
|
||||
|
||||
Reference in New Issue
Block a user