View difference between Paste ID: gxE20mrj and 6E9ucQ6F
SHOW: | | - or go back to the newest paste.
1
ResponseFetcher.cs:
2
3-
		public Task<T> GetApiResponseAsync(string url)
3+
		public async Task<T> GetApiResponseAsync(string url)
4
		{
5
			using (var client = new HttpClient()) {
6
7
				var response = await client.GetAsync(url).ConfigureAwait(false);
8
				var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
9
10
				return JsonConvert.DeserializeObject<T>(content);
11
			}
12
		}
13
14
---------------------
15
LoginViewModel.cs:
16
17
// Passing the task to RunTask():
18
19
		ResponseFetcher<Task> task = new ResponseFetcher<Task>("http://10.0.0.141:5000/");
20
21
		await task.GetApiResponseAsync("api/accounts/verify?username=test&password=test");
22
23
Error: Start may not be called on a promise-style task.