Improvments

This commit is contained in:
2020-08-20 00:15:36 +02:00
parent b84aa3db45
commit 4f92dcd3ed
3 changed files with 63 additions and 23 deletions

View File

@@ -9,7 +9,7 @@ export interface FileType {
reciever: string;
status: 'encrypting' | 'failed' | 'encrypted';
error?: any;
link?: string;
link?: Blob;
}
interface EncryptionContextType {
@@ -39,8 +39,8 @@ const encrypt = async (keys: string[], content: string) => {
const blob = new Blob([data], {
type: 'text/text',
});
const url = URL.createObjectURL(blob);
return url;
//const url = URL.createObjectURL(blob);
return blob;
};
const EncryptionProvider: React.FC = ({

View File

@@ -33,6 +33,10 @@ const GithubContext = createContext<GithubContextType>({
state: 'failed',
});
const headers = {
authorization: "token 22924bb3da8465e7e8575740f2fc0a4971c908db",
};
const GithubProvider: React.FC<Props> = ({
username,
children,
@@ -45,8 +49,8 @@ const GithubProvider: React.FC<Props> = ({
useEffect(() => {
const run = async () => {
try {
const keysRes = await fetch(`https://api.github.com/users/${username}/gpg_keys`);
const userRes = await fetch(`https://api.github.com/users/${username}`);
const keysRes = await fetch(`https://api.github.com/users/${username}/gpg_keys`, { headers });
const userRes = await fetch(`https://api.github.com/users/${username}`, { headers });
const keys = await keysRes.json();
const user = await userRes.json();
setState('ready');