Use same lock values as mobile clients
[ProtonMail-WebClient.git] / packages / shared / lib / api / helpers / response.ts
blob95c056f01082c30890b4392ff9e605510a1db6e6
1 import { API_CODES } from '../../constants';
3 const { GLOBAL_SUCCESS, SINGLE_SUCCESS } = API_CODES;
5 interface Response {
6     Response: { Code: number };
9 interface Responses {
10     Code: number;
11     Responses?: Response[];
14 export const allSucceded = ({ Code, Responses = [] }: Responses): boolean => {
15     if (Code !== GLOBAL_SUCCESS) {
16         return false;
17     }
18     return !Responses.some(({ Response: { Code } }) => Code !== SINGLE_SUCCESS);