Skip to content

Latest commit

 

History

History
91 lines (90 loc) · 3.62 KB

addUser.md

File metadata and controls

91 lines (90 loc) · 3.62 KB
<style> body { background-color: #01060d; } .bg-color{ background-color: #161666; } .btn-custom { color: #fff; background-color: #193387; border-color: #ffffff; } .btn-custom:hover, .btn-custom:focus, .btn-custom:active, .btn-custom.active, .open>.dropdown-toggle.btn-custom { color: #fff; background-color: #157347; border-color: #ffffff; } /* The message box is shown when the user clicks on the password field */ #message { display:none; position: relative; } </style> <script> const urlParams = new URLSearchParams(window.location.search); const teamId = urlParams.get('id'); const signup_url = `https://mrr.rebeccaaa.tk/api/team/addMember/${teamId}`; function addUser(){ // get user input var name = document.getElementById("name").value; var ghid = document.getElementById("ghid").value; var blog = document.getElementById("blog").value; // store data in JavaScript object let data = {"name": name, "githubId": ghid, "blog": blog}; console.log(data); const options = { method: 'POST', mode: 'cors', cache: 'no-cache', credentials: 'include', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data), // convert to JSON }; fetch(signup_url, options) .then(response => { // check for response errors if (response.status !== 201) { error('POST API response failure: ' + response.status); return; } // valid response console.log(data); // redirect on successful login }) // catch fetch errors (ie Nginx ACCESS to server blocked) .catch(err => { error(err + " " + url); }); } // Something went wrong with actions or responses function error(err) { // log as Error in console console.log(err); } </script>

Add User to Team

Name
Github ID
Blog link
Add User