feat(frontend): added logout page
This commit is contained in:
parent
4a56c92667
commit
8222ec4ea3
3 changed files with 20 additions and 0 deletions
|
|
@ -1,5 +1,8 @@
|
||||||
import { showError } from "@app/toast";
|
import { showError } from "@app/toast";
|
||||||
import client from '@app/api';
|
import client from '@app/api';
|
||||||
|
import cookie from 'js-cookie';
|
||||||
|
|
||||||
|
cookie.remove('pkce');
|
||||||
|
|
||||||
export type User = {
|
export type User = {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import './login/login.ts'
|
||||||
import './signin/signin.ts'
|
import './signin/signin.ts'
|
||||||
import './ttt/ttt.ts'
|
import './ttt/ttt.ts'
|
||||||
import './profile/profile.ts'
|
import './profile/profile.ts'
|
||||||
|
import './logout/logout.ts'
|
||||||
|
|
||||||
// ---- Initial load ----
|
// ---- Initial load ----
|
||||||
setTitle("");
|
setTitle("");
|
||||||
|
|
|
||||||
16
frontend/src/pages/logout/logout.ts
Normal file
16
frontend/src/pages/logout/logout.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { addRoute, navigateTo, setTitle, type RouteHandlerReturn } from "@app/routing";
|
||||||
|
import cookie from "js-cookie";
|
||||||
|
|
||||||
|
async function route(_url: string, _args: { [k: string]: string }): Promise<RouteHandlerReturn> {
|
||||||
|
setTitle('Logout')
|
||||||
|
return {
|
||||||
|
html: "you should have been logged out", postInsert: async (app) => {
|
||||||
|
cookie.remove("token");
|
||||||
|
navigateTo("/");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
addRoute('/logout', route, { bypass_auth: true })
|
||||||
Loading…
Add table
Add a link
Reference in a new issue