|
@@ -0,0 +1,65 @@
|
|
|
+{% extends "index.html" %}
|
|
|
+{% block title %}登入{% endblock %}
|
|
|
+{% block head %}
|
|
|
+{{ super() }}
|
|
|
+{% endblock %}
|
|
|
+
|
|
|
+
|
|
|
+{% block body %}
|
|
|
+<script >
|
|
|
+ function parseCookie() {
|
|
|
+ var cookieObj = {};
|
|
|
+ var cookieAry = document.cookie.split(';');
|
|
|
+ var cookie;
|
|
|
+
|
|
|
+ for (var i=0, l=cookieAry.length; i<l; ++i) {
|
|
|
+ cookie = jQuery.trim(cookieAry[i]);
|
|
|
+ cookie = cookie.split('=');
|
|
|
+ cookieObj[cookie[0]] = cookie[1];
|
|
|
+ }
|
|
|
+
|
|
|
+ return cookieObj;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function getCookieByName(name) {
|
|
|
+ var value = parseCookie()[name];
|
|
|
+ if (value) {
|
|
|
+ value = decodeURIComponent(value);
|
|
|
+ }
|
|
|
+
|
|
|
+ return value;
|
|
|
+}
|
|
|
+ function sendData() {
|
|
|
+
|
|
|
+ var url = 'example';
|
|
|
+ var data = {Authorization: 'Bearer ' +getCookieByName('jwt_token'),del_username : $('#del_username').val()};
|
|
|
+
|
|
|
+fetch(url, {
|
|
|
+
|
|
|
+ method: 'POST', // or 'PUT'
|
|
|
+ credentials: 'include' ,
|
|
|
+ body: JSON.stringify(data), // data can be `string` or {object}!
|
|
|
+ headers: new Headers({
|
|
|
+ 'Authorization': 'Bearer ' + getCookieByName('jwt_token')
|
|
|
+ })
|
|
|
+}).then(res => res.json())
|
|
|
+.catch(function(error) {
|
|
|
+ alert('There has been a problem with your fetch operation: ', error.message);
|
|
|
+})
|
|
|
+.then(response => console.log('Success:', response));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+</script>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <h2>delete_member</h2>
|
|
|
+ <div>
|
|
|
+ <label>帳號</label>
|
|
|
+ <input type="text" id="del_username" name="del_username" placeholder="請輸入帳號">
|
|
|
+ <button id="btn_delete" onclick="sendData()">Login</button>
|
|
|
+
|
|
|
+
|
|
|
+{% endblock %}
|