Skip to content

Commit

Permalink
wrapping up
Browse files Browse the repository at this point in the history
  • Loading branch information
uimaxbai committed Oct 27, 2023
1 parent e259da0 commit 395e685
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 106 deletions.
102 changes: 0 additions & 102 deletions src/lib/fetchIt.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/lib/fetchIt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function fetchIt(type: string, url: string, requestBody: object = {}, head
}

try {
return [await response.json(), await response.status];
return await response.json();
}
catch (e) {
return 1;
Expand Down
18 changes: 15 additions & 3 deletions src/routes/authenticate/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,24 @@
e.preventDefault();
var username = jQuery('#logInput').text();
var password = jQuery('#passwInput').text();
fetchIt('GET', 'https://api.dispatch.eu.org/api/v2/user/${username}/auth', {
let response: object = fetchIt(
'GET',
'https://api.dispatch.eu.org/api/v2/user/${username}/auth',
{
password: password
}
);
localStorage.setItem('session', response.toString());
});
jQuery('#regForm').submit((e) => {
var username = jQuery('#nameInput').text();
var password = jQuery('#passInput').text();
fetchIt('GET', 'https://api.dispatch.eu.org/api/v2/users/new', {
user: username,
password: password
});
});
jQuery('#regForm').submit((e) => {});
});
// TODO: make one for register button
Expand Down

0 comments on commit 395e685

Please sign in to comment.