Use cookies for client requests (#377)

* Use cookie for frontend request

* Remove api helper to use SDK

* Added error handling to status box

* Remove additional places that check for session.user

* Refactor sending password

* prettier clean up

* remove deadcode

* Move all authentication requests to the client

* refactor upload panel to only fetch assets after the upload panel disappear

* Added keydown to remove focus on title change on album viewer
This commit is contained in:
Alex
2022-07-26 12:28:07 -05:00
committed by GitHub
parent 2ebb755f00
commit 83cbf51704
54 changed files with 4954 additions and 4540 deletions

View File

@@ -3,21 +3,23 @@
import type { Load } from '@sveltejs/kit';
import { api } from '@api';
export const load: Load = async ({ session }) => {
const { data } = await api.userApi.getUserCount();
export const load: Load = async () => {
try {
const { data: user } = await api.userApi.getMyUserInfo();
if (session.user) {
return {
status: 302,
redirect: '/photos',
redirect: '/photos'
};
}
} catch (e) {}
const { data } = await api.userApi.getUserCount();
return {
status: 200,
props: {
isAdminUserExist: data.userCount == 0 ? false : true,
},
isAdminUserExist: data.userCount == 0 ? false : true
}
};
};
</script>