-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df30380
commit 225fb3a
Showing
13 changed files
with
143 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export default { | ||
appId: "5ea8ad97b4684c798966b99a965beb9a", | ||
authKey: "59a44ef2b37745fe93c6c660f0700184", | ||
secretKey: "65825d8c98b5461291f91726ef9cfb85", | ||
appId: "", | ||
authKey: "", | ||
secretKey: "", | ||
region: ["cn"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { useState } from "react"; | ||
|
||
export const useSessionStorage = (keyName: string, defaultValue?: any) => { | ||
const [storedValue, setStoredValue] = useState(() => { | ||
try { | ||
const value = window.sessionStorage.getItem(keyName); | ||
if (value) { | ||
return JSON.parse(value); | ||
} else { | ||
window.sessionStorage.setItem(keyName, JSON.stringify(defaultValue)); | ||
return defaultValue; | ||
} | ||
} catch (err) { | ||
console.log(err); | ||
return defaultValue; | ||
} | ||
}); | ||
const setValue = (newValue: any) => { | ||
try { | ||
window.sessionStorage.setItem(keyName, JSON.stringify(newValue)); | ||
} catch (err) { | ||
console.log(err); | ||
} | ||
if (newValue instanceof Array) { | ||
setStoredValue([...newValue]); | ||
} else { | ||
if (newValue instanceof Object) { | ||
setStoredValue({ ...newValue }); | ||
} else { | ||
setStoredValue(newValue); | ||
} | ||
} | ||
}; | ||
return [storedValue, setValue]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
.home { | ||
.item { | ||
background: #333; | ||
margin: 12px; | ||
margin: 0 auto; | ||
max-width: 600px; | ||
} | ||
.delete { | ||
color: #ffffff; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.