const putData = async (data, ms) => {
	return new Promise(resolve => {
		setTimeout(() => {
			resolve(data);
		}, ms);
	});
};

const clearAll = async () => {
	// logic to clear all data
};

const handleSettledPromiseValue = (results = []) => {
	return results.map(result => {
		if (typeof result !== 'object') {
			return result;
		}

		if (result.status !== 'fulfilled') {
			throw result.reason;
		}

		return result.value;
	});
};

try {
	const [
		result1,
		result2,
		result3
	] = handleSettledPromiseValue(await Promise.allSettled([
		putData({
			email: 'user@email.com'
		}, 1000),
		putData({
			apiKey: 'api-token'
		}, 2000),
		putData({
			settings: {
				accountName: 'John Doe',
				accountType: 'Premium'
			}
		}, 3000)
	]));
} catch(err) {
	// an error happened and we need to clear all data
	await clearAll();
}