dashboard-v2/frontend/src/views/Logout.svelte
Ryan aed0f28f13
Migrate to svelte for frontend (#9)
* Svelte: WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* Finished

* Remove redundant code

* Fix typo

* Re-add routes

* Form margin

* Mobile nicities

* Mobile changed

* Increase keepalvie

* Update Guild.svelte

* Update Whitelabel.svelte

* Whitelabel changes
2021-06-30 15:40:55 +01:00

21 lines
531 B
Svelte

<script>
import {clearLocalStorage, setDefaultHeaders} from '../includes/Auth.svelte'
import axios from "axios";
import {API_URL} from "../js/constants";
import {errorPage} from "../js/util";
setDefaultHeaders();
async function process() {
const res = await axios.post(`${API_URL}/logout`);
if (res.status !== 204) {
errorPage(res.data.error)
return
}
clearLocalStorage()
window.location.href = 'https://ticketsbot.net'
}
process()
</script>