25 lines
482 B
C#
25 lines
482 B
C#
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Exceptions;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BS.Shared.Extensions
|
|
{
|
|
public static class ApiResponseExtension
|
|
{
|
|
public static T GetResponseData<T>(this ApiResponse<T> data)
|
|
{
|
|
if (!data.Success)
|
|
{
|
|
throw new BeWoInvalidOperationException(AppError.ApiResponseFailed);
|
|
}
|
|
|
|
return data.Data;
|
|
}
|
|
}
|
|
}
|