mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-22 20:51:29 +10:00
- run eslint --fix across project
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
import firebase from "gatsby-plugin-firebase";
|
||||
import React, { createContext, useContext, useRef } from "react";
|
||||
import { toast } from "react-toastify";
|
||||
import { isFileImage } from "../utils";
|
||||
import { useDispatch, useSelector } from "./ResumeContext";
|
||||
import UserContext from "./UserContext";
|
||||
import firebase from 'gatsby-plugin-firebase';
|
||||
import React, { createContext, useContext, useRef } from 'react';
|
||||
import { toast } from 'react-toastify';
|
||||
import { isFileImage } from '../utils';
|
||||
import { useDispatch, useSelector } from './ResumeContext';
|
||||
import UserContext from './UserContext';
|
||||
|
||||
const defaultState = {
|
||||
uploadPhotograph: async () => {},
|
||||
@ -22,7 +22,7 @@ const StorageProvider = ({ children }) => {
|
||||
const uploadPhotograph = async (file) => {
|
||||
if (!isFileImage(file)) {
|
||||
toast.error(
|
||||
"You tried to upload a file that was not an image. That won't look good on your resume. Please try again."
|
||||
"You tried to upload a file that was not an image. That won't look good on your resume. Please try again.",
|
||||
);
|
||||
return null;
|
||||
}
|
||||
@ -33,16 +33,16 @@ const StorageProvider = ({ children }) => {
|
||||
.put(file);
|
||||
|
||||
let progress = 0;
|
||||
toastId.current = toast("Firing up engines...", {
|
||||
toastId.current = toast('Firing up engines...', {
|
||||
progress,
|
||||
});
|
||||
|
||||
uploadTask.on(
|
||||
"state_changed",
|
||||
'state_changed',
|
||||
(snapshot) => {
|
||||
progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
|
||||
toast.update(toastId.current, {
|
||||
render: "Uploading...",
|
||||
render: 'Uploading...',
|
||||
progress,
|
||||
hideProgressBar: false,
|
||||
});
|
||||
@ -51,23 +51,23 @@ const StorageProvider = ({ children }) => {
|
||||
async () => {
|
||||
const downloadURL = await uploadTask.snapshot.ref.getDownloadURL();
|
||||
dispatch({
|
||||
type: "on_input",
|
||||
type: 'on_input',
|
||||
payload: {
|
||||
path: "profile.photograph",
|
||||
path: 'profile.photograph',
|
||||
value: downloadURL,
|
||||
},
|
||||
});
|
||||
|
||||
toast.update(toastId.current, {
|
||||
render:
|
||||
"Your photograph was uploaded successfully... and you look great!",
|
||||
'Your photograph was uploaded successfully... and you look great!',
|
||||
progress,
|
||||
autoClose: 5000,
|
||||
hideProgressBar: true,
|
||||
});
|
||||
|
||||
toastId.current = null;
|
||||
}
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user