Compare commits
3 Commits
d1e7405780
...
d10cf03f98
| Author | SHA1 | Date |
|---|---|---|
|
|
d10cf03f98 | |
|
|
d97c13b565 | |
|
|
7caef19713 |
|
|
@ -166,10 +166,9 @@ export default function ComplainsDetails({
|
|||
|
||||
const checkKey2 = (item: any) => {
|
||||
const dcKey = Decrypt(item.cipherKeyInspector, selectedFile);
|
||||
|
||||
console.log(dcKey);
|
||||
if (dcKey != false && dcKey != null) {
|
||||
if (check) {
|
||||
localStorage.setItem("privatePassword", dcKey);
|
||||
localStorage.setItem("privateKey", selectedFile);
|
||||
}
|
||||
localStorage.setItem("trackingNumber", item.trackingNumber);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ export default function InspectorOperations({
|
|||
const password = useData((state) => state.data.password);
|
||||
const possibleOperations = complaintData?.possibleOperationsWithDescription;
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
|
||||
const form = useForm<z.infer<typeof FormSchema>>({
|
||||
resolver: zodResolver(FormSchema),
|
||||
defaultValues: {
|
||||
|
|
@ -85,10 +85,17 @@ export default function InspectorOperations({
|
|||
toast("عملیات شما با موفقیت انجام شد. ", {
|
||||
className: "!bg-green-500 !text-white",
|
||||
});
|
||||
const tk = localStorage.getItem("trackingNumber");
|
||||
// const tk = localStorage.getItem("trackingNumber");
|
||||
const storedData = JSON.parse(
|
||||
localStorage.getItem("CompliantData") as string
|
||||
);
|
||||
const dcKey = Decrypt(
|
||||
storedData.cipherKeyInspector,
|
||||
localStorage.getItem("privateKey") as string
|
||||
);
|
||||
updateData({
|
||||
trackingNumber: complaintData.trackingNumber,
|
||||
password: key2 ? key2 : (localStorage.getItem("privateKey") as string),
|
||||
password: key2 ? key2 : dcKey,
|
||||
});
|
||||
},
|
||||
onError: (err: any | string) => {
|
||||
|
|
@ -101,8 +108,11 @@ export default function InspectorOperations({
|
|||
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||
const storedData = JSON.parse(
|
||||
localStorage.getItem("CompliantData") as string
|
||||
);
|
||||
const dcKey = Decrypt(storedData.cipherKeyInspector, key2);
|
||||
);
|
||||
const dcKey = Decrypt(
|
||||
storedData.cipherKeyInspector,
|
||||
localStorage.getItem("privateKey") as string
|
||||
);
|
||||
const formData = new FormData();
|
||||
formData.append("text", data.text);
|
||||
formData.append("trackingNumber", complaintData.trackingNumber);
|
||||
|
|
@ -110,10 +120,7 @@ export default function InspectorOperations({
|
|||
if (data.type) {
|
||||
formData.append("IsPublic", data.type == "public" ? "true" : "false");
|
||||
}
|
||||
formData.append(
|
||||
"EncodedKey",
|
||||
key2 ? key2 : (localStorage.getItem("privateKey") as string)
|
||||
);
|
||||
formData.append("EncodedKey", key2 ? key2 : dcKey);
|
||||
if (data?.media && data?.media?.length > 0) {
|
||||
for (let i = 0; i < data.media.length; i++) {
|
||||
formData.append("Medias", data.media[i]);
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "sootzani",
|
||||
"version": "0.2.6",
|
||||
"version": "0.2.7",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "sootzani",
|
||||
"version": "0.2.6",
|
||||
"version": "0.2.7",
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.3.2",
|
||||
"@radix-ui/react-alert-dialog": "^1.0.5",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "sootzani",
|
||||
"version": "0.2.6",
|
||||
"version": "0.2.7",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ export async function RefreshToken(payload: { token: any; refreshToken: any }) {
|
|||
} catch (error) {
|
||||
deleteCookie("Sootzani_Token");
|
||||
deleteCookie("Sootzani_Refresh_Token");
|
||||
localStorage.removeItem("privateKey");
|
||||
window.location.href = "/";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue