diff --git a/Test2.txt b/Test2.txt new file mode 100644 index 0000000..e69de29 diff --git a/auth_required.js b/auth_required.js index 7b693a3..4a0a838 100644 --- a/auth_required.js +++ b/auth_required.js @@ -1,3 +1,14 @@ /*** * @todo Redirect the user to login page if token is not present. - */ \ No newline at end of file + */ +const U = 'https://todo-app-csoc.herokuapp.com/'; +$.ajax({ + headers: { + Authorization: 'Token ' + localStorage.getItem('token'), + }, + url: U + 'auth/profile/', + method: 'GET', + error: function(data, status, xhr) { + window.location.href='/login'; + } +}) \ No newline at end of file diff --git a/index.html b/index.html index a3bde5b..d1e8c35 100644 --- a/index.html +++ b/index.html @@ -55,61 +55,18 @@