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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 4954 additions and 4540 deletions

View file

@ -5,7 +5,7 @@ import { uploadAssetsStore } from '$lib/stores/upload';
import type { UploadAsset } from '../models/upload-asset';
import { api } from '@api';
export async function fileUploader(asset: File, accessToken: string) {
export async function fileUploader(asset: File) {
const assetType = asset.type.split('/')[0].toUpperCase();
const temp = asset.name.split('.');
const fileExtension = temp[temp.length - 1];
@ -56,7 +56,7 @@ export async function fileUploader(asset: File, accessToken: string) {
const { data, status } = await api.assetApi.checkDuplicateAsset({
deviceAssetId: String(deviceAssetId),
deviceId: 'WEB',
deviceId: 'WEB'
});
if (status === 200) {
@ -72,7 +72,7 @@ export async function fileUploader(asset: File, accessToken: string) {
id: deviceAssetId,
file: asset,
progress: 0,
fileExtension: fileExtension,
fileExtension: fileExtension
};
uploadAssetsStore.addNewUploadAsset(newUploadAsset);
@ -101,7 +101,6 @@ export async function fileUploader(asset: File, accessToken: string) {
};
request.open('POST', `${serverEndpoint}/asset/upload`);
request.setRequestHeader('Authorization', `Bearer ${accessToken}`);
request.send(formData);
} catch (e) {